Skip to content

Commit fe7ccc6

Browse files
committed
new compact attribute in the list component
1 parent 1165217 commit fe7ccc6

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- ![file upload too large](https://github.com/lovasoa/SQLpage/assets/552629/1c684d33-49bd-4e49-9ee0-ed3f0d454ced)
1414
- Fix a bug in [`sqlpage.read_file_as_data_url`](https://sql.ophir.dev/functions.sql?function=read_file_as_data_url#function) where it would truncate the mime subtype of the file. This would cause the browser to refuse to display SVG files, for instance.
1515
- Avoid vertical scrolling caused by the footer even when the page content is short.
16+
- Add a new `compact` attribute to the [list](https://sql.ophir.dev/documentation.sql?component=list#component), allowing to display more items in a list without taking up too much space. Great for displaying long lists of items.
17+
- ![compact list screenshot](https://github.com/lovasoa/SQLpage/assets/552629/41302807-c6e4-40a0-9486-bfd0ceae1537)
1618

1719
## 0.23.0 (2024-06-09)
1820

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
3232
('empty_description', 'Description to display if the list is empty.', 'TEXT', TRUE, TRUE),
3333
('empty_description_md', 'Description to display if the list is empty, in Markdown format.', 'TEXT', TRUE, TRUE),
3434
('empty_link', 'URL to which the user should be taken if they click on the empty list.', 'URL', TRUE, TRUE),
35+
('compact', 'Whether to display the list in a more compact format, allowing more items to be displayed on the screen.', 'BOOLEAN', TRUE, TRUE),
3536
-- item level
3637
('title', 'Name of the list item, displayed prominently.', 'TEXT', FALSE, FALSE),
3738
('description', 'A description of the list item, displayed as greyed-out text.', 'TEXT', FALSE, TRUE),
@@ -47,15 +48,15 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
4748
) x;
4849

4950
INSERT INTO example(component, description, properties) VALUES
50-
('list', 'The most basic list', json('[{"component":"list"},{"title":"A"},{"title":"B"},{"title":"C"}]')),
51+
('list', 'A basic compact list', json('[{"component":"list", "compact": true, "title": "SQLPage lists are..."},{"title":"Beautiful"},{"title":"Useful"},{"title":"Versatile"}]')),
5152
('list', 'An empty list with a link to add an item', json('[{"component":"list", "empty_title": "No items yet", "empty_description": "This list is empty. Click here to create a new item !", "empty_link": "documentation.sql"}]')),
5253
('list', 'A list with rich text descriptions', json('[{"component":"list"},
5354
{"title":"SQLPage", "image_url": "https://raw.githubusercontent.com/lovasoa/SQLpage/main/docs/favicon.png", "description_md":"A **SQL**-based **page** generator for **PostgreSQL**, **MySQL**, **SQLite** and **SQL Server**. [Free on Github](https://github.com/lovasoa/sqlpage)"},
5455
{"title":"Tabler", "image_url": "https://avatars.githubusercontent.com/u/35471246", "description_md":"A **free** and **open-source** **HTML** template pack based on **Bootstrap**."},
5556
{"title":"Tabler Icons", "image_url": "https://tabler.io/favicon.ico", "description_md":"A set of over **700** free MIT-licensed high-quality **SVG** icons for you to use in your web projects."}
5657
]')),
5758
('list', 'A beautiful list with bells and whistles.',
58-
json('[{"component":"list", "title":"Popular websites"}, '||
59+
json('[{"component":"list", "title":"Popular websites" }, '||
5960
'{"title":"Google", "link":"https://google.com", "description": "A search engine", "color": "red", "icon":"brand-google", "active": true }, '||
6061
'{"title":"Wikipedia", "link":"https://wikipedia.org", "description": "An encyclopedia", "color": "blue", "icon":"world", "edit_link": "?edit=wikipedia", "delete_link": "?delete=wikipedia" }]'));
6162

sqlpage/templates/list.handlebars

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<div class="card my-2 {{class}}" {{#if id}}id="{{id}}"{{/if}}>
22
{{#if title}}
3-
<div class="card-header ">
3+
<div class="card-header {{#if compact}}py-2{{/if}}">
44
<h2 class="card-title">{{title}}</h2>
55
</div>
66
{{/if}}
77
<div class="list-group list-group-flush list-group-hoverable">
88
{{#each_row}}
99
<div {{#if id}}id="{{id}}"{{/if}}
10-
class="list-group-item list-group-item-action {{#if active}}active{{/if}} {{class}}">
11-
10+
class="list-group-item list-group-item-action {{#if active}}active{{/if}} {{#if ../compact}}py-1{{/if}} {{class}}">
1211
<div class="row align-items-center">
1312
{{#if link}}
1413
<a href="{{link}}" class="col text-truncate row align-items-center text-decoration-none link-body-emphasis">

0 commit comments

Comments
 (0)