From 8ef9d21b9d7359313ca9de10a23137056f66e411 Mon Sep 17 00:00:00 2001 From: Olivier Auverlot <@olivierauverlot> Date: Sat, 3 Feb 2024 14:17:22 +0100 Subject: [PATCH 01/11] Initial carousel component implementation --- .../sqlpage/migrations/34_carousel.sql | 135 ++++++++++++++++++ sqlpage/templates/carousel.handlebars | 39 +++++ 2 files changed, 174 insertions(+) create mode 100644 examples/official-site/sqlpage/migrations/34_carousel.sql create mode 100644 sqlpage/templates/carousel.handlebars diff --git a/examples/official-site/sqlpage/migrations/34_carousel.sql b/examples/official-site/sqlpage/migrations/34_carousel.sql new file mode 100644 index 00000000..5f8729af --- /dev/null +++ b/examples/official-site/sqlpage/migrations/34_carousel.sql @@ -0,0 +1,135 @@ +INSERT INTO component (name, description, icon, introduced_in_version) +VALUES ( + 'carousel', + 'A carousel is used to display multiple pieces of visual content without taking up too much space.', + 'carousel-horizontal', + '0.18.3' + ); +INSERT INTO parameter ( + component, + name, + description, + type, + top_level, + optional + ) +VALUES ( + 'carousel', + 'name', + 'An unique string to identify the caroussel component in the HTML page.', + 'TEXT', + TRUE, + FALSE + ), + ( + 'carousel', + 'title', + 'A name to display at the top of the carousel.', + 'TEXT', + TRUE, + TRUE + ), + ( + 'carousel', + 'indicators', + 'Style of image indicators (square or dot).', + 'TEXT', + TRUE, + TRUE + ), + ( + 'carousel', + 'vertical', + 'Whether to use the vertical image indicators.', + 'BOOLEAN', + TRUE, + TRUE + ), + ( + 'carousel', + 'controls', + 'Whether to show the control links to go previous or next item.', + 'BOOLEAN', + TRUE, + TRUE + ), + ( + 'carousel', + 'width', + 'Width of the component, between 1 and 12.', + 'NUMBER', + TRUE, + FALSE + ), + ( + 'carousel', + 'center', + 'Whether to center the carousel.', + 'BOOLEAN', + TRUE, + TRUE + ), + ( + 'carousel', + 'fade', + 'Whether to apply the fading effect.', + 'BOOLEAN', + TRUE, + TRUE + ), + ( + 'carousel', + 'image', + 'The URL (absolute or relative) of an image to display in the carousel.', + 'URL', + FALSE, + FALSE + ), + ( + 'carousel', + 'title', + 'Add caption to the slide.', + 'TEXT', + FALSE, + TRUE + ), + ( + 'carousel', + 'description', + 'A short paragraph.', + 'TEXT', + FALSE, + TRUE + ), + ( + 'carousel', + 'description_md', + 'A short paragraph formatted using markdown.', + 'TEXT', + FALSE, + TRUE + ); +-- Insert example(s) for the component +INSERT INTO example(component, description, properties) +VALUES ( + 'carousel', + 'A basic example of carousel', + JSON( + '[ + {"component":"carousel","name":"cats1","title":"Cats","width":6}, + {"image":"https://placekitten.com/408/285"}, + {"image":"https://placekitten.com/408/286"} + ]' + ) + ), + ( + 'carousel', + 'An advanced example of carousel with controls', + JSON( + '[ + {"component":"carousel","name":"cats2","title":"Cats","width":6,"center":"TRUE","controls":"TRUE"}, + {"image":"https://placekitten.com/408/285","title":"A first cat","description":"The cat (Felis catus), commonly referred to as the domestic cat or house cat, is the only domesticated species in the family Felidae."}, + {"image":"https://placekitten.com/408/286","title":"Another cat"} + ]' + ) + ); \ No newline at end of file diff --git a/sqlpage/templates/carousel.handlebars b/sqlpage/templates/carousel.handlebars new file mode 100644 index 00000000..695d6697 --- /dev/null +++ b/sqlpage/templates/carousel.handlebars @@ -0,0 +1,39 @@ +
+
+ {{#if title}} +
+
{{title}}
+
+ {{/if}} + +
+ {{#if controls}} + + + Previous + + + + Next + + {{/if}} +
From 9734360e5be8ea7804a38cef309d9db7bd31f215 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Sat, 3 Feb 2024 14:34:49 +0100 Subject: [PATCH 02/11] change carousel example --- .../official-site/sqlpage/migrations/34_carousel.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/official-site/sqlpage/migrations/34_carousel.sql b/examples/official-site/sqlpage/migrations/34_carousel.sql index 5f8729af..4ac566f2 100644 --- a/examples/official-site/sqlpage/migrations/34_carousel.sql +++ b/examples/official-site/sqlpage/migrations/34_carousel.sql @@ -56,10 +56,10 @@ VALUES ( ( 'carousel', 'width', - 'Width of the component, between 1 and 12.', + 'Width of the component, between 1 and 12. Default is 12.', 'NUMBER', TRUE, - FALSE + TRUE ), ( 'carousel', @@ -116,9 +116,9 @@ VALUES ( 'A basic example of carousel', JSON( '[ - {"component":"carousel","name":"cats1","title":"Cats","width":6}, - {"image":"https://placekitten.com/408/285"}, - {"image":"https://placekitten.com/408/286"} + {"component":"carousel","name":"cats1","title":"Famous Database Animals"}, + {"image":"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Elefantes_africanos_de_sabana_%28Loxodonta_africana%29%2C_Elephant_Sands%2C_Botsuana%2C_2018-07-28%2C_DD_114-117_PAN.jpg/2560px-Elefantes_africanos_de_sabana_%28Loxodonta_africana%29%2C_Elephant_Sands%2C_Botsuana%2C_2018-07-28%2C_DD_114-117_PAN.jpg"}, + {"image":"https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Penguin_Island_panorama_with_ferry_and_dolphins_in_foreground%2C_March_2023_06.jpg/1280px-Penguin_Island_panorama_with_ferry_and_dolphins_in_foreground%2C_March_2023_06.jpg"} ]' ) ), From edfb4a903add1aebc2137b2199d252a7a6e12484 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Sat, 3 Feb 2024 14:36:12 +0100 Subject: [PATCH 03/11] make the carousel text description more readable by adding a background --- sqlpage/templates/carousel.handlebars | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlpage/templates/carousel.handlebars b/sqlpage/templates/carousel.handlebars index 695d6697..1aa31d39 100644 --- a/sqlpage/templates/carousel.handlebars +++ b/sqlpage/templates/carousel.handlebars @@ -14,6 +14,7 @@