Skip to content

Commit 6a8338a

Browse files
committed
add tabler table icons
1 parent d2eb7fa commit 6a8338a

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
350350
-- top level
351351
('sort', 'Make the columns clickable to let the user sort by the value contained in the column.', 'BOOLEAN', TRUE, TRUE),
352352
('search', 'Add a search bar at the top of the table, letting users easily filter table rows by value.', 'BOOLEAN', TRUE, TRUE),
353-
('markdown', 'Set this to the name of a column whose content should be interpreted as markdown . Used to display rich text with links in the table. This argument can be repeated multiple times to intepret multiple columns as markdown.', 'TEXT', TRUE, TRUE)
353+
('markdown', 'Set this to the name of a column whose content should be interpreted as markdown . Used to display rich text with links in the table. This argument can be repeated multiple times to intepret multiple columns as markdown.', 'TEXT', TRUE, TRUE),
354+
('icon', 'Set this to the name of a column whose content should be interpreted as a tabler icon name. Used to display icons in the table. This argument can be repeated multiple times to intepret multiple columns as icons.', 'TEXT', TRUE, TRUE),
354355
) x;
355356

356357
INSERT INTO example(component, description, properties) VALUES
@@ -361,9 +362,9 @@ INSERT INTO example(component, description, properties) VALUES
361362
'{"Forename": "Ophir", "Surname": "Lojkine", "Pseudonym": "lovasoa"},' ||
362363
'{"Forename": "Linus", "Surname": "Torvalds", "Pseudonym": "torvalds"}]')),
363364
('table', 'A table that uses markdown to display links',
364-
json('[{"component":"table", "markdown": "Documentation"}, '||
365-
'{"name": "table", "description": "Displays SQL results as a searchable table.", "Documentation": "[docs](documentation.sql?component=table)"},
366-
{"name": "chart", "description": "Show graphs based on numeric data.", "Documentation": "[docs](documentation.sql?component=chart)"}
365+
json('[{"component":"table", "markdown": "Documentation", "icon": "icon"}, '||
366+
'{"icon": "table", "name": "Table", "description": "Displays SQL results as a searchable table.", "Documentation": "[docs](documentation.sql?component=table)"},
367+
{"icon": "timeline", "name": "Chart", "description": "Show graphs based on numeric data.", "Documentation": "[docs](documentation.sql?component=chart)"}
367368
]'));
368369

369370

sqlpage/sqlpage.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/* !include https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/css/tabler.min.css */
2-
/* !include https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/css/tabler-vendors.min.css */
2+
/* !include https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/css/tabler-vendors.min.css */
3+
4+
td > p {
5+
margin: 0;
6+
}

sqlpage/templates/table.handlebars

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@
2727

2828
<tr>
2929
{{~#each this~}}
30-
<td class="{{@key}}">
30+
<td class="{{@key}} align-middle">
3131
{{~#if (array_contains ../../markdown @key)~}}
3232
{{{markdown this}}}
33+
{{~else~}}
34+
{{~#if (array_contains ../../icon @key)~}}
35+
<i class="ti ti-{{this}}"></i>
3336
{{~else~}}
3437
{{this}}
3538
{{~/if~}}
39+
{{~/if~}}
3640
</td>
3741
{{~/each~}}
3842
</tr>

0 commit comments

Comments
 (0)