-
Notifications
You must be signed in to change notification settings - Fork 2
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
docs(loader): update the react loader documentation #1812
Merged
Merged
Changes from all commits
Commits
Show all changes
2 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
57 changes: 38 additions & 19 deletions
57
docs/app/views/examples/components/loader/_preview.html.erb
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 |
---|---|---|
@@ -1,29 +1,48 @@ | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">Without text</h2> | ||
<div class="sage-row"> | ||
<div class="sage-col--md-6 example__block--lg"> | ||
<h2>Variants</h2> | ||
|
||
<h3>Bar</h3> | ||
<%= sage_component SageGridRow, {} do %> | ||
<%= sage_component SageGridCol, { size: 12, css_classes: "example__block--lg" } do %> | ||
<%= sage_component SageLoader, { | ||
type: "spinner" | ||
type: "bar" | ||
} %> | ||
</div> | ||
<div class="sage-col--md-6 example__block--lg"> | ||
<%= sage_component SageLoader, { | ||
type: "success" | ||
} %> | ||
</div> | ||
</div> | ||
<hr> | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">With text</h2> | ||
<div class="sage-row"> | ||
<div class="sage-col--md-6 example__block--lg"> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= sage_component SageDivider, {} %> | ||
|
||
<h3>Spinner</h3> | ||
<%= sage_component SageGridRow, {} do %> | ||
<%= sage_component SageGridCol, { size: 6, css_classes: "example__block--lg" } do %> | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">With text</h2> | ||
<%= sage_component SageLoader, { | ||
type: "spinner", | ||
text: true | ||
} %> | ||
</div> | ||
<div class="sage-col--md-6 example__block--lg"> | ||
<% end %> | ||
<%= sage_component SageGridCol, { size: 6, css_classes: "example__block--lg" } do %> | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">Without text</h2> | ||
<%= sage_component SageLoader, { | ||
type: "spinner" | ||
} %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= sage_component SageDivider, {} %> | ||
|
||
<h3>Success</h3> | ||
<%= sage_component SageGridRow, {} do %> | ||
<%= sage_component SageGridCol, { size: 6, css_classes: "example__block--lg" } do %> | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">With text</h2> | ||
<%= sage_component SageLoader, { | ||
type: "success", | ||
text: true | ||
} %> | ||
</div> | ||
</div> | ||
<% end %> | ||
<%= sage_component SageGridCol, { size: 6, css_classes: "example__block--lg" } do %> | ||
<h2 class="<%= SageClassnames::TYPE::HEADING_6 %>">Without text</h2> | ||
<%= sage_component SageLoader, { | ||
type: "success" | ||
} %> | ||
<% end %> | ||
<% end %> |
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
<tr> | ||
<td><%= md('`type`') %><%= sage_component SageBadge, { color: "published", value: "required" } %></td> | ||
<td><%= md('Determines which loader will be used; `spinner` or `success`') %></td> | ||
<td><%= md('String') %></td> | ||
<td><%= md('`nil`') %></td> | ||
<td><%= md('`fill`') %> | ||
<td><%= md('If true, will fill the space within the container.') %></td> | ||
<td><%= md('Boolean') %></td> | ||
<td><%= md('`false`') %></td> | ||
</tr> | ||
<tr> | ||
<td><%= md('`text`') %></td> | ||
<td><%= md('Includes text that aligns with the loader.') %></td> | ||
<td><%= md('Boolean') %></td> | ||
<td><%= md('`false`') %></td> | ||
</tr> | ||
<tr> | ||
<td><%= md('`type`') %><%= sage_component SageBadge, { color: "published", value: "required" } %></td> | ||
<td><%= md('Determines which loader will be used; `bar`, `spinner` or `success`') %></td> | ||
<td><%= md('String') %></td> | ||
<td><%= md('`nil`') %></td> | ||
</tr> | ||
|
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 was deleted.
Oops, something went wrong.
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,127 @@ | ||
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs'; | ||
import { Loader } from './Loader'; | ||
|
||
<Meta | ||
title="Sage/Loader" | ||
component={Loader} | ||
argTypes={{ | ||
type: { | ||
name: 'Type', | ||
description: 'The type of Loader to be rendered', | ||
options: Object.values(Loader.TYPES) | ||
} | ||
}} | ||
args={{ | ||
loading: true, | ||
}} | ||
/> | ||
|
||
# Loader | ||
|
||
Animated UI elements indicating that a page, section, or action is loading. | ||
|
||
## Usage Guidelines | ||
|
||
- Communicate that the system is working on a request. | ||
|
||
### When to use | ||
|
||
- Communicate to the user that something is loading. | ||
- Any action that cannot be performed instantly and will require a short time to process. | ||
|
||
## Accessibility | ||
|
||
We achieve accessibility by leveraging the ARIA attributes `aria-live` and `aria-busy`. Each of these provide information to | ||
screen readers and assitive tech. | ||
|
||
- ARIA Busy indicates that an element is currently in a state of being updated or undergoing changes. | ||
- ARIA Live at its core defines how dynamic content changes are announced to the user. We use the `Polite` option, which informs the user | ||
without interrupting the user. | ||
|
||
## Properties | ||
|
||
<ArgsTable story="Default" /> | ||
|
||
### Types of Loaders | ||
- Bar | ||
- Spinner | ||
- Spinner in Button | ||
- Success | ||
- Typing | ||
|
||
## Variants | ||
|
||
### Default | ||
When using the component in its default state, it will use the default type of `SPINNER` | ||
|
||
<Canvas> | ||
<Story name="Default"> | ||
<Loader loading={true} /> | ||
</Story> | ||
</Canvas> | ||
|
||
### Bar | ||
The continuous progress bar is used when the content and the indefinable loading progress of the system | ||
are to be displayed in the view at the same time. | ||
|
||
<Canvas> | ||
<Story name="Bar"> | ||
<Loader loading={true} type={Loader.TYPES.BAR} /> | ||
</Story> | ||
</Canvas> | ||
|
||
### Spinner | ||
The continuous spinner is used when loading progress cannot be determined. They indicate to the user | ||
with continuous movement that the system is still processing. | ||
|
||
<Canvas> | ||
<Story name="Spinner"> | ||
<Loader loading={true} type={Loader.TYPES.SPINNER} /> | ||
</Story> | ||
</Canvas> | ||
|
||
### Success | ||
This should be used to notify the user that the process/request has been completed succesfully. | ||
|
||
<Canvas> | ||
<Story name="Success"> | ||
<Loader loading={true} type={Loader.TYPES.SUCCESS} /> | ||
</Story> | ||
</Canvas> | ||
|
||
### Typing | ||
This loading indicator is good when you want to provide feedback to the user that they are typing. | ||
|
||
<Canvas> | ||
<Story name="Typing"> | ||
<Loader loading={true} type={Loader.TYPES.TYPING} /> | ||
</Story> | ||
</Canvas> | ||
|
||
## Additional Properties | ||
|
||
### Fill Space (deprecated) | ||
<Canvas> | ||
<Story name="Fill Space - Deprecated"> | ||
<div> | ||
<Loader loading={true} fillSpace={true} /> | ||
</div> | ||
</Story> | ||
</Canvas> | ||
|
||
### Hide when Done | ||
Setting this property will hide the loader when the process/request has been completed. | ||
<Canvas> | ||
<Story name="Hide When Done - Deprecated"> | ||
<Loader hideWhenDone={true} /> | ||
</Story> | ||
</Canvas> | ||
|
||
### Label | ||
Allows you to provide custom text to the Spinner loader. | ||
|
||
<Canvas> | ||
<Story name="Label"> | ||
<Loader loading={true} label="My loading label...." type={Loader.TYPES.SPINNER} /> | ||
</Story> | ||
</Canvas> |
Oops, something went wrong.
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.
If
fillSpace
is deprecated, can we reflect that in the args table?