Skip to content

Commit ea07818

Browse files
committed
responsive design in the card component
1 parent 59c9cf4 commit ea07818

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ and does not even need to listen on port 80 to do so.
117117
- The `cookie` component now supports setting the `SameSite` attribute of cookies, and defaults to `SameSite=Strict` for all cookies. What this means in practice is that cookies set by SQLPage will not be sent to your website if the user is coming from another website. This prevents someone from tricking your users into executing SQLPage queries on your website by sending them a malicious link.
118118
- Bugfix: setting `min` or `max` to `0` in a number field in the `form` component now works as expected.
119119
- Added support for `.env` files to set SQLPage's [environment variables](./configuration.md#environment-variables).
120+
- Better responsive design in the card component. Up to 5 cards per line on large screens. The number of cards per line is still customizable with the `columns` attribute.
120121

121122
## 0.16.1 (2023-11-22)
122123

docs/cards.png

640 KB
Loading

examples/official-site/examples/tabs.sql

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
create table if not exists tab_example_cards as
2-
select 'Leaf' as title, 'Leaf_1_web' as img, 'f4' as prefix, 'green' as color union all
3-
select 'Caterpillar', 'Caterpillar_of_box_tree_moth%2C_Germany_2019', 'a9', 'green' union all
4-
select 'Butterfly', 'Common_brimstone_butterfly_(Gonepteryx_rhamni)_male', '6a', 'green' union all
5-
select 'Flower', 'Red-poppy-flower_-_West_Virginia_-_ForestWander', 'fd', 'red' union all
6-
select 'Bird', 'Summer_tanager_(Piranga_rubra)_male_Copan_3', 'dd', 'red' union all
7-
select 'Medusa', 'Aurelia_aurita_2', '5c', 'blue';
2+
select 'Leaf' as title, 'Leaf_1_web' as img, 'f4' as prefix, 'green' as color, 'Autumn''s dance begins, Crimson leaves in breezy waltz, Nature''s fleeting art.' as description union all
3+
select 'Caterpillar', 'Caterpillar_of_box_tree_moth%2C_Germany_2019', 'a9', 'green', 'Caterpillar crawls, silent transformation unfolds.' union all
4+
select 'Butterfly', 'Common_brimstone_butterfly_(Gonepteryx_rhamni)_male', '6a', 'green', 'Cocoon unfolds wings, fleeting transformation.' union all
5+
select 'Flower', 'Red-poppy-flower_-_West_Virginia_-_ForestWander', 'fd', 'red', 'Blossom in the sun, vibrant beauty blooms.' union all
6+
select 'Bird', 'Summer_tanager_(Piranga_rubra)_male_Copan_3', 'dd', 'red', 'Winged melody soars' union all
7+
select 'Medusa', 'Aurelia_aurita_2', '5c', 'blue', 'Mythic curse unveiled';
88

99
select 'tab' as component, true as center;
1010
select 'Show all cards' as title, 'All things are beautiful' as description, '?' as link, $tab is null as active;
@@ -18,9 +18,10 @@ group by color;
1818

1919

2020
select 'card' as component;
21-
select title,
21+
select title, description,
2222
format('https://upload.wikimedia.org/wikipedia/commons/thumb/%s/%s/%s.jpg/640px-%s.jpg', substr(prefix,1,1), prefix, img, img) as top_image,
23-
color
23+
color,
24+
'https://en.wikipedia.org/wiki/File:' || img || '.jpg' as link
2425
from tab_example_cards
2526
where $tab is null or $tab = color;
2627

sqlpage/templates/card.handlebars

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
row
1212
row-cols-1
1313
{{#if columns}}
14-
{{#if (gt columns 2)}}row-cols-md-2{{/if}}
15-
row-cols-xl-{{columns}}
14+
{{#if (gt columns 2)}}row-cols-sm-2{{/if}}
15+
row-cols-lg-{{columns}}
1616
{{else}}
17-
row-cols-xl-3
17+
row-cols-sm-2
18+
row-cols-md-3
19+
row-cols-lg-4
20+
row-cols-xl-5
1821
{{/if}}
1922
gx-2 gy-2
2023
mt-1 mb-3">

0 commit comments

Comments
 (0)