-
-
Notifications
You must be signed in to change notification settings - Fork 154
New component : Empty state #890
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e940ae2
empty_state component added
olivierauverlot 0a6a3d7
empty_state component added
olivierauverlot 689c614
Correction and new example
olivierauverlot 8c8865d
rename status_code to header
lovasoa 50d714f
Enhance empty_state component documentation and template to support r…
lovasoa 2e1c4dc
add and document class and id attributes
lovasoa 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
28 changes: 28 additions & 0 deletions
28
examples/official-site/sqlpage/migrations/60_empty_state.sql
This file contains hidden or 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,28 @@ | ||
| INSERT INTO component(name, icon, description, introduced_in_version) VALUES | ||
| ('empty_state', 'info-circle', 'Empty states are placeholders for first-use, empty data, or error screens', '0.35.0'); | ||
|
|
||
| INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'empty_state', * FROM (VALUES | ||
| ('title','Description of the empty state.','TEXT',TRUE,FALSE), | ||
| ('status_code','HTTP status code displayed on the top of the empty state.','INTEGER',TRUE,TRUE), | ||
| ('icon','Name of an icon to be displayed on the top of the empty state.','ICON',TRUE,TRUE), | ||
| ('image','The URL (absolute or relative) of an image to display at the top of the empty state.','URL',TRUE,TRUE), | ||
| ('information','A short text displayed below the title.','TEXT',TRUE,FALSE), | ||
lovasoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ('btn_title','The text displayed on the button.','TEXT',TRUE,FALSE), | ||
lovasoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ('btn_icon','Name of an icon to be displayed on the left side of the button.','ICON',TRUE,FALSE), | ||
lovasoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ('link','The URL to which the button should navigate when clicked.','URL',TRUE,FALSE) | ||
| ) x; | ||
|
|
||
| INSERT INTO example(component, description, properties) VALUES | ||
| ('empty_state', ' | ||
| The empty_state component provides users with informative and visually appealing placeholders when there is no content to display in a particular section of an application or website. Its role is to enhance user experience by guiding users on what to do next, offering suggestions, or providing context about the absence of data. This component includes a title, a description, an action button and often an illustration or icon. The empty_state component helps to reduce confusion and encourages users to take action. | ||
| ', | ||
| json('[{ | ||
| "component": "empty_state", | ||
| "title": "No results found", | ||
| "status_code": 404, | ||
| "information": "Try adjusting your search or filter to find what you''re looking for.", | ||
| "btn_title": "Search again", | ||
| "btn_icon": "search", | ||
| "link": "#" | ||
| }]')); | ||
|
|
||
25 changes: 25 additions & 0 deletions
25
examples/official-site/sqlpage/templates/empty_state.handlebars
This file contains hidden or 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 @@ | ||
| <div class="empty"> | ||
| {{#if status_code}} | ||
| <div class="empty-header">{{status_code}}</div> | ||
| {{else}} | ||
| {{#if icon}} | ||
| <div class="empty-icon"> | ||
| <span>{{icon_img icon }}</span> | ||
| </div> | ||
| {{else}} | ||
| {{#if image}} | ||
| <div class="empty-img"><img src="{{image}}" height="128" alt="{{image}}"/></div> | ||
| {{/if}} | ||
| {{/if}} | ||
| {{/if}} | ||
| <p class="{{title}}">No results found</p> | ||
| <p class="empty-subtitle text-secondary"> | ||
| {{information}} | ||
| </p> | ||
| <div class="empty-action"> | ||
| <a href="{{link}}" class="btn btn-primary"> | ||
| <span class="me-1">{{icon_img btn_icon}}</span> | ||
| {{btn_title}} | ||
| </a> | ||
| </div> | ||
| </div> | ||
lovasoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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 @@ | ||
| <div class="empty"> | ||
| {{#if status_code}} | ||
| <div class="empty-header">{{status_code}}</div> | ||
| {{else}} | ||
| {{#if icon}} | ||
| <div class="empty-icon"> | ||
| <span>{{icon_img icon }}</span> | ||
| </div> | ||
| {{else}} | ||
| {{#if image}} | ||
| <div class="empty-img"><img src="{{image}}" height="128" alt="{{image}}"/></div> | ||
| {{/if}} | ||
| {{/if}} | ||
| {{/if}} | ||
| <p class="{{title}}">No results found</p> | ||
lovasoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <p class="empty-subtitle text-secondary"> | ||
| {{information}} | ||
| </p> | ||
| <div class="empty-action"> | ||
| <a href="{{link}}" class="btn btn-primary"> | ||
| <span class="me-1">{{icon_img btn_icon}}</span> | ||
| {{btn_title}} | ||
| </a> | ||
| </div> | ||
| </div> | ||
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.
Uh oh!
There was an error while loading. Please reload this page.