-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added initial implementation of loader - spinner #1631
Open
nitinja
wants to merge
4
commits into
develop
Choose a base branch
from
component/vf-indicator-loader
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin | ||
.github | ||
.travis.yml | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### 1.0.0-alpha.1 | ||
|
||
* Basic implementation of vf-indicator-loader component | ||
* [Tracking issue](https://github.com/visual-framework/vf-core/issues/1332) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Loader component | ||
|
||
[![npm version](https://badge.fury.io/js/%40visual-framework%2Fvf-indicator-loader.svg)](https://badge.fury.io/js/%40visual-framework%2Fvf-indicator-loader) | ||
|
||
## About | ||
|
||
Use these when content or a page is still in the progress of being loaded. | ||
|
||
## Usage | ||
|
||
- Spinner variant: This indicator should be reserved for actions that take between 2-10 seconds. | ||
- Progress variant: [To come](https://github.com/visual-framework/vf-core/issues/1332) | ||
- Skeleton variant: [To come](https://github.com/visual-framework/vf-core/issues/1332) | ||
|
||
[Recommended reading related reading](https://www.nngroup.com/articles/progress-indicators/) on usage of loader elements. Less is better. | ||
|
||
## Install | ||
|
||
This repository is distributed with [npm][https://www.npmjs.com/]. After [installing npm][https://www.npmjs.com/get-npm] and [yarn](https://classic.yarnpkg.com/en/docs/install), you can install `vf-indicator-loader` with this command. | ||
|
||
``` | ||
$ yarn add --dev @visual-framework/vf-indicator-loader | ||
``` | ||
|
||
### JS | ||
|
||
You should import this component in `./components/vf-component-rollup/scripts.js` or your other JS process: | ||
|
||
```js | ||
// no js yet for this component | ||
``` | ||
|
||
### Sass/CSS | ||
|
||
The style files included are written in [Sass](https://sass-lang.com/). If you're using a VF-core project, you can import it like this: | ||
|
||
``` | ||
@import "@visual-framework/vf-indicator-loader/index.scss"; | ||
``` | ||
|
||
Make sure you import Sass requirements along with the modules. You can use a [project boilerplate](https://stable.visual-framework.dev/building/) or the [`vf-sass-starter`](https://stable.visual-framework.dev/components/vf-sass-starter/) | ||
|
||
## Help | ||
|
||
- [Read the Visual Framework troubleshooting](https://stable.visual-framework.dev/troubleshooting/) | ||
- [Open a ticket](https://github.com/visual-framework/vf-core/issues) | ||
- [Chat on Slack](https://join.slack.com/t/visual-framework/shared_invite/enQtNDAxNzY0NDg4NTY0LWFhMjEwNGY3ZTk3NWYxNWVjOWQ1ZWE4YjViZmY1YjBkMDQxMTNlNjQ0N2ZiMTQ1ZTZiMGM4NjU5Y2E0MjM3ZGQ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// setup files required | ||
|
||
// sass-lint:disable clean-import-paths | ||
@import 'vf-global-variables'; | ||
@import 'vf-variables'; | ||
@import 'vf-functions'; | ||
@import 'vf-mixins'; | ||
|
||
// component specific styles | ||
|
||
@import 'vf-indicator-loader.variables.scss'; | ||
@import 'vf-indicator-loader.scss'; | ||
|
||
// component variant styles | ||
// @import 'vf-indicator-loader--variant.scss'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"version": "1.0.0-alpha.0", | ||
"name": "@visual-framework/vf-indicator-loader", | ||
"description": "vf-indicator-loader component", | ||
"homepage": "", | ||
"author": "VF", | ||
"license": "Apache 2.0", | ||
"style": "vf-indicator-loader.css", | ||
"sass": "index.scss", | ||
"main": "build/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repo": "https://github.com/visual-framework/vf-core/tree/develop/components/vf-indicator-loader", | ||
"bugs": { | ||
"url": "https://github.com/visual-framework/vf-core/issues" | ||
}, | ||
"keywords": [ | ||
"fractal", | ||
"component" | ||
] | ||
} |
25 changes: 25 additions & 0 deletions
25
components/vf-indicator-loader/vf-indicator-loader.config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# The title shown on the component page | ||
title: Loader | ||
# Label shown on index pages | ||
label: Loader | ||
status: alpha | ||
# The template used from /components/_previews | ||
# | ||
# Per-variant options | ||
variants: | ||
- name: default | ||
hidden: true | ||
- name: spinner | ||
context: | ||
container: false | ||
# Global component context | ||
context: | ||
component-type: block | ||
# custom-values: passed as {{custom-values}} | ||
# - note: you in your custom-values you should use dashes `-` | ||
# and not underscores `_` as underscores prevent inherited template use | ||
# title: Title text | ||
# text: String of text | ||
# image: ../../assets/vf-component-name/assets/vf-component-name.png | ||
# - note on paths: be sure to prefix with `../../` | ||
# - Why? https://github.com/visual-framework/vf-core/issues/364 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// vf-indicator-loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// vf-indicator-loader for React | ||
// See vf-extensions-react for usage guidance | ||
|
||
import React from "react"; | ||
import "./vf-indicator-loader.scss"; | ||
|
||
export function VFLoader({ container = false }) { | ||
return container ? ( | ||
<div className="vf-box"> | ||
<div className="vf-indicator-loader--spinner__container"> | ||
<_VFLoader /> | ||
</div> | ||
</div> | ||
) : ( | ||
<_VFLoader /> | ||
); | ||
} | ||
|
||
function _VFLoader() { | ||
return <div className="vf-indicator-loader--spinner__circle"></div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{# Make sure any variables are listed inside the following if statement #} | ||
{% if context %} | ||
{% set container = context.container %} | ||
{% endif %} | ||
|
||
{% if container == true %} | ||
<!-- this HTML is for container if enabled --> | ||
<div class="vf-box"> | ||
<div class="vf-indicator-loader--spinner__container"> | ||
{% endif %} | ||
|
||
<div class="vf-indicator-loader--spinner__circle"></div> | ||
|
||
{% if example == true %} | ||
<!-- this HTML is for container if enabled --> | ||
</div> | ||
</div> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// vf-indicator-loader | ||
|
||
// **Thinking about deleting this file?** | ||
// If your component needs no CSS/Sass, we still recommend leaving the | ||
// scss files in place. As this is primarily a CSS framework, it is better to | ||
// leave the empty files so you know a file wasn't accidently omitted. | ||
// If you don't have any Sass, you can trim this block down to: | ||
// "This page was intentionally left blank" | ||
|
||
@import 'package.variables.scss'; | ||
// Debug information from component's `package.json`: | ||
// --- | ||
/*! | ||
* Component: #{map-get($componentInfo, 'name')} | ||
* Version: #{map-get($componentInfo, 'version')} | ||
* Location: #{map-get($componentInfo, 'location')} | ||
* Build time: #{map-get($componentInfo, 'buildTimeStamp')} | ||
*/ | ||
|
||
@import 'vf-indicator-loader.variables.scss'; | ||
|
||
.vf-indicator-loader--spinner__circle { | ||
--vf-indicator-loader--border-color: var(--vf-indicator-loader--border-color, --vf-color--neutral--300); | ||
--vf-indicator-loader--border-color-highlight: var(--vf-indicator-loader--border-color-highlight, --vf-color--neutral--600); | ||
animation: rotate 1s linear infinite; | ||
border-radius: 50%; | ||
border-right-color: neutral(600); // IE11 fallback | ||
border-right-color: --vf-indicator-loader--border-color-highlight; | ||
border-style: solid; | ||
border-width: 4px; | ||
color: neutral(300); // IE11 fallback | ||
color: --vf-indicator-loader--border-color; | ||
display: inline-block; | ||
height: 32px; | ||
position: relative; | ||
width: 32px; | ||
} | ||
|
||
@keyframes rotate { | ||
0% { | ||
transform: rotate(0); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.vf-indicator-loader--spinner__container { | ||
align-items: center; | ||
display: flex; | ||
height: 20rem; | ||
justify-content: center; | ||
width: 100%; | ||
} |
10 changes: 10 additions & 0 deletions
10
components/vf-indicator-loader/vf-indicator-loader.variables.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
// vf-indicator-loader Sass variables file. | ||
// ------------------------------------------------------------ | ||
|
||
// ------------------------------------------------------------ | ||
// Default component variables | ||
// ------------------------------------------------------------ | ||
|
||
// $vf-indicator-loader--example-bg-color: set-color(vf-color--yellow); | ||
// $vf-indicator-loader--example2-bg-color: set-ui-color(vf-ui-color--grey); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
further above you used
{% if container == true %}
... did you mean tocontainer
here as well?