Skip to content

Commit 50d714f

Browse files
committed
Enhance empty_state component documentation and template to support rich text formatting. Update docs with detailed descriptions and examples, and modify Handlebars template to conditionally render Markdown content.
1 parent 8c8865d commit 50d714f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

examples/official-site/sqlpage/migrations/60_empty_state.sql

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
2-
('empty_state', 'info-circle', 'Empty states are placeholders for first-use, empty data, or error screens', '0.35.0');
2+
('empty_state', 'info-circle', 'Displays a large placeholder message to communicate a single information to the user and invite them to take action.
3+
4+
Typically includes a title, an optional icon/image, descriptive text (rich text formatting and images supported via Markdown), and a call-to-action button.
5+
6+
Ideal for first-use screens, empty data sets, "no results" pages, or error messages.', '0.35.0');
37

48
INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'empty_state', * FROM (VALUES
59
('title','Description of the empty state.','TEXT',TRUE,FALSE),
@@ -14,7 +18,10 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
1418

1519
INSERT INTO example(component, description, properties) VALUES
1620
('empty_state', '
17-
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.
21+
This example shows how to create a 404-style "Not Found" empty state with
22+
- a prominent header displaying "404",
23+
- a helpful description suggesting to adjust search parameters, and
24+
- a "Search again" button with a search icon that links back to the search page.
1825
',
1926
json('[{
2027
"component": "empty_state",
@@ -32,7 +39,9 @@ It''s possible to use an icon or an image to illustrate the problem.
3239
"component": "empty_state",
3340
"title": "A critical problem has occurred",
3441
"icon": "mood-wrrr",
35-
"description": "Thank you for restarting your browser and crossing your fingers.",
42+
"description_md": "SQLPage can do a lot of things, but this is not one of them.
43+
44+
Please restart your browser and **cross your fingers**.",
3645
"link_text": "Close and restart",
3746
"link_icon": "rotate-clockwise",
3847
"link": "#"

sqlpage/templates/empty_state.handlebars

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
{{/if}}
1414
{{/if}}
1515
<p class="empty-title">{{title}}</p>
16-
<p class="empty-subtitle text-secondary">
17-
{{description}}
18-
</p>
16+
<div class="empty-subtitle text-secondary remove-bottom-margin">
17+
{{~#if description}}<p>{{description}}</p>{{/if~}}
18+
{{~#if description_md~}}
19+
{{{markdown description_md}}}
20+
{{~/if~}}
21+
</div>
22+
1923
<div class="empty-action">
2024
<a href="{{link}}" class="btn btn-primary">
2125
<span class="me-1">{{icon_img link_icon}}</span>

0 commit comments

Comments
 (0)