Skip to content

Commit aecf3f1

Browse files
committed
**divider component**: Add new properties to the divider component: link, bold, italics, underline, size.
#617
1 parent 0a9390f commit aecf3f1

File tree

3 files changed

+90
-10
lines changed

3 files changed

+90
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- fix the display of the page title when it is long and the sidebar display is enabled.
1616
- Fix an issue where the color name `blue` could not be used in the chart component.
1717
- Add new properties to the foldable component: `id`, `class`, and `expanded` (to control the state of the foldable item). The old behavior was having the first foldable item initially opened and the others closed. To keep the old behavior, you need to explicitly set `true as expanded` on the first foldable item.
18+
- **divider component**: Add new properties to the divider component: `link`, `bold`, `italics`, `underline`, `size`.
1819

1920
## 0.28.0 (2024-08-31)
2021
- Chart component: fix the labels of pie charts displaying too many decimal places.

examples/official-site/sqlpage/migrations/29_divider_component.sql

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,70 @@ VALUES (
3737
'COLOR',
3838
TRUE,
3939
TRUE
40+
),
41+
(
42+
'divider',
43+
'size',
44+
'The size of the divider text, from 1 to 6.',
45+
'INTEGER',
46+
TRUE,
47+
TRUE
48+
),
49+
(
50+
'divider',
51+
'bold',
52+
'Whether the text is bold.',
53+
'BOOLEAN',
54+
TRUE,
55+
TRUE
56+
),
57+
(
58+
'divider',
59+
'italics',
60+
'Whether the text is italicized.',
61+
'BOOLEAN',
62+
TRUE,
63+
TRUE
64+
),
65+
(
66+
'divider',
67+
'underline',
68+
'Whether the text is underlined.',
69+
'BOOLEAN',
70+
TRUE,
71+
TRUE
72+
),
73+
(
74+
'divider',
75+
'link',
76+
'URL of the link for the divider text. Available only when contents is present.',
77+
'URL',
78+
TRUE,
79+
TRUE
4080
);
81+
4182
-- Insert example(s) for the component
4283
INSERT INTO example(component, description, properties)
43-
VALUES
84+
VALUES
4485
(
4586
'divider',
46-
'A divider with centered text',
87+
'An empty divider',
4788
JSON(
4889
'[
4990
{
50-
"component":"divider",
51-
"contents":"Hello"
91+
"component":"divider"
5292
}
5393
]'
5494
)
5595
),
5696
(
5797
'divider',
58-
'An empty divider',
98+
'A divider with centered text',
5999
JSON(
60100
'[
61101
{
62-
"component":"divider"
102+
"component":"divider",
103+
"contents":"Hello"
63104
}
64105
]'
65106
)
@@ -79,15 +120,33 @@ VALUES
79120
),
80121
(
81122
'divider',
82-
'A divider with blue text at right',
123+
'A divider with blue text and a link',
83124
JSON(
84125
'[
85126
{
86127
"component":"divider",
87-
"contents":"Hello",
88-
"position":"right",
128+
"contents":"SQLPage components",
129+
"link":"/documentation.sql",
89130
"color":"blue"
90131
}
91132
]'
92133
)
134+
),
135+
(
136+
'divider',
137+
'A divider with bold, italic, and underlined text',
138+
JSON(
139+
'[
140+
{
141+
"component":"divider",
142+
"contents":"Important notice",
143+
"position":"left",
144+
"color":"red",
145+
"size":5,
146+
"bold":true,
147+
"italics":true,
148+
"underline":true
149+
}
150+
]'
151+
)
93152
);

sqlpage/templates/divider.handlebars

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
{{#if contents}}
2-
<div class="hr-text {{#if position}}hr-text-{{position}}{{/if}} {{#if color}}text-{{color}}{{/if}} {{class}}">{{contents}}</div>
2+
<div class="
3+
hr-text
4+
{{~#if position}} hr-text-{{position}}{{/if}}
5+
{{~#if color}} text-{{color}} {{/if~}}
6+
{{~#if bold}} fw-bold {{/if~}}
7+
{{~#if italics}} fst-italic {{/if~}}
8+
{{~#if underline}} text-decoration-underline {{/if~}}
9+
{{~#if size}} fs-{{minus 7 size}} {{/if~}}
10+
{{~#if class}} {{class}}{{/if~}}
11+
">
12+
{{#if link}}
13+
<a
14+
href="{{link}}"
15+
class="{{#if color}} text-{{color}} {{/if}}"
16+
>
17+
{{contents}}
18+
</a>
19+
{{else}}
20+
{{contents}}
21+
{{/if}}
22+
</div>
323
{{else}}
424
<hr class="{{class}}" />
525
{{/if}}

0 commit comments

Comments
 (0)