Skip to content

Commit 642cb21

Browse files
committed
new component: button
creates a row of buttons to implement easy navigation
1 parent f94f4d7 commit 642cb21

File tree

3 files changed

+83
-4
lines changed

3 files changed

+83
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# CHANGELOG.md
22

3-
## 0.14.0 (unreleased)
3+
## 0.14.0 (2023-10-19)
44

5+
- Better support for time series in the [chart](https://sql.ophir.dev/documentation.sql?component=chart#component) component. You can now use the `time` top-attribute to display a time series chart
6+
with smart x-axis labels.
7+
- **New component**: [button](https://sql.ophir.dev/documentation.sql?component=button#component). This allows you to create rows of buttons that allow navigation between pages.
58
- Better error messages for Microsoft SQL Server. SQLPage now displays the line number of the error, which is especially useful for debugging long migration scripts.
69
- Many improvements in the official website and the documentation.
710
- Most notably, the documentation now has syntax highlighting on code blocks (using [prism](https://prismjs.com/) with a custom theme made for tabler). This also illustrates the usage of external javascript and css libraries in SQLPage. See [the shell component documentation](https://sql.ophir.dev/documentation.sql?component=shell#component).
811
- Better display of example queries in the documentation, with smart indentation that makes it easier to read.
9-
- CLarify some ambiguous error messages:
12+
- Clarify some ambiguous error messages:
1013
- make it clearer whether the error comes from SQLPage or from the database
1114
- specific tokenization errors are now displayed as such
12-
- Better support for time series in the [chart](https://sql.ophir.dev/documentation.sql?component=chart#component) component. You can now use the `time` top-attribute to display a time series chart
13-
with smart x-axis labels.
1415

1516
## 0.13.0 (2023-10-16)
1617
- New [timeline](https://sql.ophir.dev/documentation.sql?component=timeline#component) component to display a timeline of events.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
-- Button Component Documentation
2+
3+
-- Component Definition
4+
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
5+
('button', 'hand-click', 'A versatile button component do display one or multiple button links of different styles.', '0.14.0');
6+
7+
-- Inserting parameter information for the button component
8+
INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'button', * FROM (VALUES
9+
-- Top-level parameters (for the whole button list)
10+
('justify', 'The horizontal alignment of the button list (e.g., start, end, center, between).', 'TEXT', TRUE, TRUE),
11+
('size', 'The size of the buttons (e.g., sm, lg).', 'TEXT', TRUE, TRUE),
12+
('shape', 'Shape of the buttons (e.g., pill, square)', 'TEXT', TRUE, TRUE),
13+
-- Item-level parameters (for each button)
14+
('link', 'The URL to which the button should navigate when clicked.', 'URL', FALSE, TRUE),
15+
('color', 'The color of the button (e.g., red, green, blue, but also primary, warning, danger, orange, etc.).', 'TEXT', FALSE, TRUE),
16+
('title', 'The text displayed on the button.', 'TEXT', FALSE, TRUE),
17+
('disabled', 'Whether the button is disabled or not.', 'BOOLEAN', FALSE, TRUE),
18+
('outline', 'Outline color of the button (e.g. red, purple, ...)', 'TEXT', FALSE, TRUE),
19+
('space_after', 'Whether there should be extra space to the right of the button. In a line of buttons, this will put the buttons before this one on the left, and the ones after on the right.', 'BOOLEAN', FALSE, TRUE),
20+
('icon', 'An icon (from tabler-icons) to be displayed on the left side of the button.', 'TEXT', FALSE, TRUE)
21+
) x;
22+
23+
-- Inserting example information for the button component
24+
INSERT INTO example(component, description, properties) VALUES
25+
('button', 'A basic button with a link',
26+
json('[{"component":"button"}, {"link":"/documentation.sql", "title":"Enabled"}, {"link":"#", "title":"Disabled", "disabled":true}]'))
27+
;
28+
29+
30+
INSERT INTO example(component, description, properties) VALUES
31+
('button', 'A button with a custom shape, size, and outline color',
32+
json('[{"component":"button", "size":"sm", "shape":"pill" },
33+
{"title":"Purple", "outline":"purple" },
34+
{"title":"Orange", "outline":"orange" },
35+
{"title":"Red", "outline":"red" }]')
36+
);
37+
38+
INSERT INTO example(component, description, properties) VALUES
39+
('button', 'A list of buttons aligned in the center',
40+
json('[{"component":"button", "justify":"center"},
41+
{"link":"#", "color":"light", "title":"Light"},
42+
{"link":"#", "color":"success", "title":"Success"},
43+
{"link":"#", "color":"info", "title":"Info"},
44+
{"link":"#", "color":"dark", "title":"Dark"},
45+
{"link":"#", "color":"warning", "title":"Warning"}]')
46+
);
47+
48+
INSERT INTO example(component, description, properties) VALUES
49+
('button', 'Buttons with icons and different sizes',
50+
json('[{"component":"button", "size":"lg" },
51+
{"link":"#", "outline":"azure", "title":"Edit", "icon":"edit"},
52+
{"link":"#", "outline":"danger", "title":"Delete", "icon":"trash"}]')
53+
);
54+
55+
INSERT INTO example(component, description, properties) VALUES
56+
('button', 'A row of square buttons with spacing in between',
57+
json('[{"component":"button", "shape":"square"},
58+
{"link":"#", "color":"green", "title":"Save" },
59+
{"link":"#", "color":"orange", "title":"Cancel", "space_after":true},
60+
{"link":"#", "outline":"indigo", "title":"Preview" }]')
61+
);

sqlpage/templates/button.handlebars

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div class="btn-list mb-2 {{#if justify}}justify-content-{{justify}}{{/if}}">
2+
{{#each_row}}
3+
<a href="{{link}}"
4+
class="btn {{#if disabled}} disabled{{/if}}
5+
{{~#if color}} btn-{{color}}{{/if}}
6+
{{~#if ../size}} btn-{{../size}}{{/if}}
7+
{{~#if outline}} btn-outline-{{outline}}{{/if}}
8+
{{~#if ../shape}} btn-{{../shape}}{{/if}}
9+
{{~#if space_after}} me-auto{{/if}}"
10+
role="button">
11+
{{~#if icon~}}
12+
<span class="me-1">{{~icon_img icon~}}</span>
13+
{{~/if~}}
14+
{{~title~}}
15+
</a>
16+
{{/each_row}}
17+
</div>

0 commit comments

Comments
 (0)