From 24ab647e43608b27ac8749163666b6f8e75a5ab0 Mon Sep 17 00:00:00 2001 From: Ophir Lojkine Date: Sat, 28 Nov 2026 23:46:33 +0000 Subject: [PATCH] Move card, hero, and carousel examples beside their references --- .../official-site/content/components/card.md | 129 ++++++++++++ .../components/card/examples/01-grid.md | 22 +++ .../components/card/examples/02-dashboard.md | 21 ++ .../card/examples/03-image-gallery.md | 33 ++++ .../card/examples/04-variable-width.md | 23 +++ .../card/examples/05-remote-content.md | 15 ++ .../content/components/carousel.md | 61 ++++++ .../components/carousel/examples/01-basic.md | 12 ++ .../carousel/examples/02-controls.md | 20 ++ .../official-site/content/components/hero.md | 70 +++++++ .../components/hero/examples/01-basic.md | 8 + .../hero/examples/02-background-image.md | 26 +++ .../components/hero/examples/03-video.md | 11 ++ .../sqlpage/migrations/02_hero_component.sql | 184 ------------------ .../migrations/31_card_docs_update.sql | 92 --------- .../sqlpage/migrations/34_carousel.sql | 163 ---------------- .../migrations/82_reference_catalog.sql | 3 - .../99_shared_id_class_attributes.sql | 10 +- 18 files changed, 453 insertions(+), 450 deletions(-) create mode 100644 examples/official-site/content/components/card.md create mode 100644 examples/official-site/content/components/card/examples/01-grid.md create mode 100644 examples/official-site/content/components/card/examples/02-dashboard.md create mode 100644 examples/official-site/content/components/card/examples/03-image-gallery.md create mode 100644 examples/official-site/content/components/card/examples/04-variable-width.md create mode 100644 examples/official-site/content/components/card/examples/05-remote-content.md create mode 100644 examples/official-site/content/components/carousel.md create mode 100644 examples/official-site/content/components/carousel/examples/01-basic.md create mode 100644 examples/official-site/content/components/carousel/examples/02-controls.md create mode 100644 examples/official-site/content/components/hero.md create mode 100644 examples/official-site/content/components/hero/examples/01-basic.md create mode 100644 examples/official-site/content/components/hero/examples/02-background-image.md create mode 100644 examples/official-site/content/components/hero/examples/03-video.md delete mode 100644 examples/official-site/sqlpage/migrations/02_hero_component.sql delete mode 100644 examples/official-site/sqlpage/migrations/34_carousel.sql diff --git a/examples/official-site/content/components/card.md b/examples/official-site/content/components/card.md new file mode 100644 index 000000000..4f9051891 --- /dev/null +++ b/examples/official-site/content/components/card.md @@ -0,0 +1,129 @@ +--- +icon: credit-card +category: display-data +summary: Arrange records in cards with images, links, or embedded content. +top: + - class + - name: columns + type: INTEGER + description: The number of columns in the grid of cards. This is just a hint, the grid will adjust dynamically + to the user's screen size, rendering fewer columns if needed to fit the contents. To control the size + of cards individually, use the `width` row-level property instead. + - name: description + type: TEXT + description: A short paragraph displayed below the title. + - name: description_md + type: TEXT + description: A short paragraph displayed below the title - formatted using markdown. + - name: title + type: TEXT + description: Text header at the top of the list of cards. +row: + - name: active + type: BOOLEAN + description: Whether this item in the grid is considered "active". Active items are displayed more prominently. + - name: allow + type: TEXT + description: The permissions policy of the iframe embed code, for instance "fullscreen; clipboard-write". + Used only when embed_mode is 'iframe'. + - name: background_color + type: COLOR + description: The background color of the card. + - class + - name: color + type: COLOR + description: The name of a color, to be displayed on the left of the card to highlight it. If the embed + parameter is enabled and you don't have a title or description, this parameter won't apply. + - name: description + type: TEXT + description: |- + The body of the card, where you put the main text contents of the card. + This does not support rich text formatting, only plain text. + If you want to use rich text formatting, use the `description_md` property instead. + - name: description_md + type: TEXT + description: |2- + + The body of the card, in Markdown format. + This is useful if you want to display a lot of text in the card, with many options for formatting, such as + line breaks, **bold**, *italics*, lists, #titles, [links](target.sql), ![images](photo.jpg), etc. + - name: embed + type: TEXT + description: |- + A url whose contents will be fetched and injected into the body of this card. + This can be used to inject arbitrary html content, but is especially useful for injecting + the output of other sql files rendered by SQLPage. For the latter case you can pass the + `?_sqlpage_embed` query parameter, which will skip the shell layout. + Components inside the fetched content initialize automatically. Custom scripts that insert + SQLPage fragments should dispatch a bubbling `fragment-loaded` event on the element containing + the new content. Initialization includes that element and its descendants; dispatching the + event on `document` initializes pending components throughout the page. Repeated events + preserve existing form and widget handlers + - name: embed_mode + type: TEXT + description: |- + Set to 'iframe' to embed the target (specified through embed property) in an iframe. + Unless this is explicitly set, the embed target is fetched and injected within the parent page. If embed_mode is set to iframe, + You can also set height and width parameters to configure the appearance and the sandbox and allow parameters to configure + security aspects of the iframe. Refer to the [MDN page](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) + for an explanation of these parameters. + - name: embed_title + type: TEXT + description: Accessible name of the iframe. Defaults to the card title, or Embedded content if no title is set. + - name: footer + type: TEXT + description: Muted text to display at the bottom of the card. + - name: footer_link + type: URL + description: An URL to which the user should be taken when they click on the footer. + - name: footer_md + type: TEXT + description: Muted text to display at the bottom of the card, with rich text formatting in Markdown format. + - name: height + type: INTEGER + description: Height of the iframe embed code, in pixels. Used only when embed_mode is 'iframe'. + - name: icon + type: ICON + description: Name of an icon to display on the right side of the card. + - id + - name: link + type: URL + description: An URL to which the user should be taken when they click on the card. + - name: sandbox + type: TEXT + description: The restrictions to apply to the iframe embed code, for instance "allow-scripts allow-same-origin". + Used only when embed_mode is 'iframe'. + - name: style + type: TEXT + description: 'Inline style property to your iframe embed code. For example "background-color: #FFFFFF"' + - name: target + type: TEXT + description: 'Where the card''s link opens: "_blank" for a new tab, "_self" for the same tab, "_parent" + for the parent frame, or "_top" for the full body of the window.' + - name: title + type: TEXT + required: true + description: Name of the card, displayed at the top. + - name: top_image + type: URL + description: The URL (absolute or relative) of an image to display at the top of the card. + - name: top_image_alt + type: TEXT + description: Alternative text for an informative card image. Leave empty if decorative. + - name: top_image_height + type: INTEGER + description: Specify the top image height, in pixels. Helps prevent layout shifts. + - name: top_image_lazy + type: BOOLEAN + description: Whether the top image must be lazily loaded. Defaults to false, meaning eagerly loaded. + - name: top_image_width + type: INTEGER + description: Specify the top image width, in pixels. Helps prevent layout shifts. + - name: width + type: INTEGER + description: The width of the card, between 1 (smallest) and 12 (full-width). The default width is 3, resulting + in 4 cards per line. When embed_mode is 'iframe', this is used as the width of the iframe instead, and + defaults to 100%. +--- + +A grid where each element is a small card that displays a piece of data. diff --git a/examples/official-site/content/components/card/examples/01-grid.md b/examples/official-site/content/components/card/examples/01-grid.md new file mode 100644 index 000000000..eb80da3c6 --- /dev/null +++ b/examples/official-site/content/components/card/examples/01-grid.md @@ -0,0 +1,22 @@ +--- +rows: + - component: card + title: Popular SQLPage features + columns: 2 + - title: Download as spreadsheet + link: ?component=csv#component + description: Using the CSV component, you can download your data as a spreadsheet. + icon: file-plus + color: green + footer_md: SQLPage can both [read](?component=form#component) and [write](?component=csv#component) **CSV** + files. + - title: Custom components + link: /custom_components.sql + description: If you know some HTML, you can create your own components for your application. + icon: code + color: orange + footer_md: You can look at the [source of the official components](https://github.com/sqlpage/SQLPage/tree/main/sqlpage/templates) + for inspiration. +--- + +A beautiful card grid with bells and whistles, showing examples of SQLPage features. diff --git a/examples/official-site/content/components/card/examples/02-dashboard.md b/examples/official-site/content/components/card/examples/02-dashboard.md new file mode 100644 index 000000000..8cca72541 --- /dev/null +++ b/examples/official-site/content/components/card/examples/02-dashboard.md @@ -0,0 +1,21 @@ +--- +rows: + - component: card + columns: 4 + - description_md: '**152** sales today' + active: true + icon: currency-euro + - description_md: '**13** new users' + icon: user-plus + color: green + - description_md: '**2** complaints' + icon: alert-circle + color: danger + link: ?view_complaints + background_color: red-lt + - description_md: '**1** pending support request' + icon: mail-question + color: warning +--- + +You can use cards to display a dashboard with quick access to important information. Use [markdown](https://www.markdownguide.org/basic-syntax) to format the text. diff --git a/examples/official-site/content/components/card/examples/03-image-gallery.md b/examples/official-site/content/components/card/examples/03-image-gallery.md new file mode 100644 index 000000000..08aa5a390 --- /dev/null +++ b/examples/official-site/content/components/card/examples/03-image-gallery.md @@ -0,0 +1,33 @@ +--- +rows: + - component: card + title: My favorite animals in pictures + columns: 3 + - title: Lynx + description_md: The **lynx** is a medium-sized **wild cat** native to Northern, Central and Eastern Europe + to Central Asia and Siberia, the Tibetan Plateau and the Himalayas. + top_image_alt: A Eurasian lynx + top_image: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Lynx_lynx_-_05.jpg/330px-Lynx_lynx_-_05.jpg + top_image_width: 330 + top_image_height: 495 + top_image_lazy: true + icon: star + - title: Squirrel + description_md: The **chipmunk** is a small, striped rodent of the family Sciuridae. Chipmunks are found + in North America, with the exception of the Siberian chipmunk which is found primarily in Asia. + top_image_alt: A squirrel eating a nut + top_image: https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/American_squirrel_eating_nut%2C_13_Jun_2013.JPG/330px-American_squirrel_eating_nut%2C_13_Jun_2013.JPG + top_image_width: 330 + top_image_height: 495 + top_image_lazy: true + - title: Spider + description_md: The **jumping spider family** (_Salticidae_) contains more than 600 described genera and + about *6000 described species*, making it the largest family of spiders with about 13% of all species. + top_image_alt: An orb weaver spinning a web + top_image: https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Australian_orb_weaver_spinning_web.jpg/330px-Australian_orb_weaver_spinning_web.jpg + top_image_width: 330 + top_image_height: 495 + top_image_lazy: true +--- + +A gallery of images. diff --git a/examples/official-site/content/components/card/examples/04-variable-width.md b/examples/official-site/content/components/card/examples/04-variable-width.md new file mode 100644 index 000000000..348c64adf --- /dev/null +++ b/examples/official-site/content/components/card/examples/04-variable-width.md @@ -0,0 +1,23 @@ +--- +rows: + - component: card + title: Beautifully colored cards + - title: Red card + color: red + background_color: red-lt + description: Penalty! You are out! + icon: play-football + - title: Blue card + color: blue + width: 6 + background_color: blue-lt + description: The Blue Card facilitates migration of foreigners to Europe. + icon: currency-euro + - title: Green card + color: green + background_color: green-lt + description: Welcome to the United States of America ! + icon: user-dollar +--- + +Beautifully colored cards with variable width. The blue card (width 6) takes half the screen, whereas of the red and green cards have the default width of 3 diff --git a/examples/official-site/content/components/card/examples/05-remote-content.md b/examples/official-site/content/components/card/examples/05-remote-content.md new file mode 100644 index 000000000..f9ee3a616 --- /dev/null +++ b/examples/official-site/content/components/card/examples/05-remote-content.md @@ -0,0 +1,15 @@ +--- +rows: + - component: card + title: Card with embedded remote content + columns: 2 + - title: Embedded Chart + embed: /examples/chart.sql + - title: Embedded Video + embed: https://www.youtube.com/embed/mXdgmSdaXkg + allow: accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share + embed_mode: iframe + height: '350' +--- + +The first card embeds a SQLPage chart as a page fragment. The second embeds a video player in an iframe with its own `height` and `allow` attributes. diff --git a/examples/official-site/content/components/carousel.md b/examples/official-site/content/components/carousel.md new file mode 100644 index 000000000..c633b249d --- /dev/null +++ b/examples/official-site/content/components/carousel.md @@ -0,0 +1,61 @@ +--- +icon: carousel-horizontal +since: 0.18.3 +category: display-data +summary: Show a slideshow of images with optional captions and controls. +top: + - name: auto + type: BOOLEAN + description: Whether to automatically cycle through the carousel items. Default is false. + - name: center + type: BOOLEAN + description: Whether to center the carousel. + - class + - name: controls + type: BOOLEAN + description: Whether to show the control links to go previous or next item. + - name: delay + type: INTEGER + description: Specify the delay, in milliseconds, between two images. + - name: fade + type: BOOLEAN + description: Whether to apply the fading effect. + - id + - name: indicators + type: TEXT + description: Style of image indicators (square or dot). + - name: title + type: TEXT + description: A name to display at the top of the carousel. + - name: vertical + type: BOOLEAN + description: Whether to use the vertical image indicators. + - name: width + type: INTEGER + description: Width of the component, between 1 and 12. Default is 12. +row: + - name: description + type: TEXT + description: A short paragraph. + - name: description_md + type: TEXT + description: A short paragraph formatted using markdown. + - name: height + type: INTEGER + description: The height of the image, in pixels. + - name: image + type: URL + required: true + description: The URL (absolute or relative) of an image to display in the carousel. + - name: image_alt + type: TEXT + description: Alternative text describing the slide image. Leave empty if the image is decorative or its caption already describes it. + - name: title + type: TEXT + description: Add caption to the slide. + - name: width + type: INTEGER + description: The width of the image, in pixels. +--- + +A carousel is used to display images. When used with multiple images, it will cycle through them automatically or with controls, creating a slideshow. diff --git a/examples/official-site/content/components/carousel/examples/01-basic.md b/examples/official-site/content/components/carousel/examples/01-basic.md new file mode 100644 index 000000000..022bad922 --- /dev/null +++ b/examples/official-site/content/components/carousel/examples/01-basic.md @@ -0,0 +1,12 @@ +--- +rows: + - component: carousel + name: cats1 + title: Famous Database Animals + - image_alt: African elephants at a watering hole + 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/1280px-Elefantes_africanos_de_sabana_%28Loxodonta_africana%29%2C_Elephant_Sands%2C_Botsuana%2C_2018-07-28%2C_DD_114-117_PAN.jpg + - image_alt: A panoramic view of Penguin Island + 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 +--- + +A basic example of carousel diff --git a/examples/official-site/content/components/carousel/examples/02-controls.md b/examples/official-site/content/components/carousel/examples/02-controls.md new file mode 100644 index 000000000..1235f2337 --- /dev/null +++ b/examples/official-site/content/components/carousel/examples/02-controls.md @@ -0,0 +1,20 @@ +--- +rows: + - component: carousel + title: SQL web apps + width: 10 + center: true + controls: true + auto: true + - image: /sqlpage_cover_image.webp + title: SQLPage is modern + description: Built by engineers who have built so many web applications the old way, they decided they + just wouldn't anymore. + height: 512 + - image: /sqlpage_illustration_alien.webp + title: SQLPage is easy + description: SQLPage connects to your database, then it turns your SQL queries into nice websites. + height: 512 +--- + +An advanced example of carousel with controls diff --git a/examples/official-site/content/components/hero.md b/examples/official-site/content/components/hero.md new file mode 100644 index 000000000..7b0009b55 --- /dev/null +++ b/examples/official-site/content/components/hero.md @@ -0,0 +1,70 @@ +--- +icon: home +category: page-layout +summary: Introduce a page with a headline, media, and a call to action. +top: + - name: autoplay + type: BOOLEAN + description: Automatically start playing the video + - name: description + type: TEXT + description: A description of the page. Displayed below the title, in smaller characters and slightly greyed + out. + - name: description_md + type: TEXT + description: A description of the page. Displayed below the title, in smaller characters and slightly greyed + out - formatted using markdown. + - id + - name: image + type: URL + description: The URL of an image to display next to the page title. + - name: link + type: URL + description: Creates a large "call to action" button below the description, linking to the specified URL. + - name: link_text + type: TEXT + description: The text to display in the call to action button. Defaults to "Go". + - name: loop + type: BOOLEAN + description: Loop the video + - name: muted + type: BOOLEAN + description: Mute the video + - name: nocontrols + type: BOOLEAN + description: Hide the video controls (play, pause, volume, etc.), and autoplay the video. + - name: poster + type: URL + description: URL of the image to be displayed before the video starts. Ignored if no video is present. + - name: reverse + type: BOOLEAN + description: 'Reverse the order of the image and text: the image will be on the left, and the text on the + right. On small screens, the image will be above the text.' + - name: title + type: TEXT + description: The title of your page. Will be shown in very large characters at the top. + - name: video + type: URL + description: The URL of a video to display next to the page title. +row: + - name: color + type: COLOR + description: Color of the badge behind the feature section's icon. Defaults to "success". + - name: description + type: TEXT + description: Description of the feature section. + - name: description_md + type: TEXT + description: Description of the feature section - formatted using markdown. + - name: icon + type: ICON + description: Icon of the feature section. + - name: link + type: TEXT + description: An URL to which the user should be taken when they click on the section title. + - name: title + type: TEXT + description: The name of a single feature section highlighted by this hero. +--- + +Display a large title and description for your page, with an optional large illustrative image. Useful in your home page, for instance. diff --git a/examples/official-site/content/components/hero/examples/01-basic.md b/examples/official-site/content/components/hero/examples/01-basic.md new file mode 100644 index 000000000..2860656e0 --- /dev/null +++ b/examples/official-site/content/components/hero/examples/01-basic.md @@ -0,0 +1,8 @@ +--- +rows: + - component: hero + title: Welcome + description: This is a very simple site built with SQLPage. +--- + +The simplest possible hero section diff --git a/examples/official-site/content/components/hero/examples/02-background-image.md b/examples/official-site/content/components/hero/examples/02-background-image.md new file mode 100644 index 000000000..03ed29373 --- /dev/null +++ b/examples/official-site/content/components/hero/examples/02-background-image.md @@ -0,0 +1,26 @@ +--- +rows: + - component: hero + title: SQLPage + description_md: Documentation for the *SQLPage* low-code web application framework. + image: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Lac_de_Zoug.jpg/1280px-Lac_de_Zoug.jpg + link: /documentation.sql + link_text: Read Documentation ! + - title: Fast + description: Pages load instantly, even on slow mobile networks. + icon: car + color: red + link: / + - title: Beautiful + description: Uses pre-defined components that look professional. + icon: eye + color: green + link: / + - title: Easy + description_md: You can teach yourself enough SQL to use [**SQLPage**](https://sql-page.com) in a weekend. + icon: sofa + color: blue + link: / +--- + +A hero with a background image. diff --git a/examples/official-site/content/components/hero/examples/03-video.md b/examples/official-site/content/components/hero/examples/03-video.md new file mode 100644 index 000000000..ba7083034 --- /dev/null +++ b/examples/official-site/content/components/hero/examples/03-video.md @@ -0,0 +1,11 @@ +--- +rows: + - component: hero + title: Databases + reverse: true + description_md: '# “The goal is to turn data into information, and information into insight.”' + poster: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Lac_de_Zoug.jpg/1280px-Lac_de_Zoug.jpg + video: /sqlpage_introduction_video.mp4 +--- + +A hero with a video diff --git a/examples/official-site/sqlpage/migrations/02_hero_component.sql b/examples/official-site/sqlpage/migrations/02_hero_component.sql deleted file mode 100644 index bee6a8d90..000000000 --- a/examples/official-site/sqlpage/migrations/02_hero_component.sql +++ /dev/null @@ -1,184 +0,0 @@ --- Hero -INSERT INTO - component(name, icon, description) -VALUES - ( - 'hero', - 'home', - 'Display a large title and description for your page, with an optional large illustrative image. Useful in your home page, for instance.' - ); - -INSERT INTO - parameter( - component, - name, - description, - type, - top_level, - optional - ) -SELECT - 'hero', - * -FROM - ( - VALUES - -- top level - ( - 'title', - 'The title of your page. Will be shown in very large characters at the top.', - 'TEXT', - TRUE, - TRUE - ), - ( - 'description', - 'A description of the page. Displayed below the title, in smaller characters and slightly greyed out.', - 'TEXT', - TRUE, - TRUE - ), - ( - 'description_md', - 'A description of the page. Displayed below the title, in smaller characters and slightly greyed out - formatted using markdown.', - 'TEXT', - TRUE, - TRUE - ), - ( - 'image', - 'The URL of an image to display next to the page title.', - 'URL', - TRUE, - TRUE - ), - ( - 'video', - 'The URL of a video to display next to the page title.', - 'URL', - TRUE, - TRUE - ), - ( - 'link', - 'Creates a large "call to action" button below the description, linking to the specified URL.', - 'URL', - TRUE, - TRUE - ), - ( - 'link_text', - 'The text to display in the call to action button. Defaults to "Go".', - 'TEXT', - TRUE, - TRUE - ), - ( - 'poster', - 'URL of the image to be displayed before the video starts. Ignored if no video is present.', - 'URL', - TRUE, - TRUE - ), - ( - 'nocontrols', - 'Hide the video controls (play, pause, volume, etc.), and autoplay the video.', - 'BOOLEAN', - TRUE, - TRUE - ), - ('muted', 'Mute the video', 'BOOLEAN', TRUE, TRUE), - ('autoplay', 'Automatically start playing the video', 'BOOLEAN', TRUE, TRUE), - ('loop', 'Loop the video', 'BOOLEAN', TRUE, TRUE), - ( - 'reverse', - 'Reverse the order of the image and text: the image will be on the left, and the text on the right. On small screens, the image will be above the text.', - 'BOOLEAN', - TRUE, - TRUE - ), - -- item level - ( - 'title', - 'The name of a single feature section highlighted by this hero.', - 'TEXT', - FALSE, - TRUE - ), - ( - 'description', - 'Description of the feature section.', - 'TEXT', - FALSE, - TRUE - ), - ( - 'description_md', - 'Description of the feature section - formatted using markdown.', - 'TEXT', - FALSE, - TRUE - ), - ( - 'icon', - 'Icon of the feature section.', - 'ICON', - FALSE, - TRUE - ), - ( - 'color', - 'Color of the badge behind the feature section''s icon. Defaults to "success".', - 'COLOR', - FALSE, - TRUE - ), - ( - 'link', - 'An URL to which the user should be taken when they click on the section title.', - 'TEXT', - FALSE, - TRUE - ) - ) x; - -INSERT INTO - example(component, description, properties) -VALUES - ( - 'hero', - 'The simplest possible hero section', - json( - '[{ - "component":"hero", - "title": "Welcome", - "description": "This is a very simple site built with SQLPage." - }]' - ) - ), - ( - 'hero', - 'A hero with a background image.', - json( - '[{ - "component":"hero", - "title": "SQLPage", - "description_md": "Documentation for the *SQLPage* low-code web application framework.", - "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Lac_de_Zoug.jpg/1280px-Lac_de_Zoug.jpg", - "link": "/documentation.sql", - "link_text": "Read Documentation !"},' || '{"title": "Fast", "description": "Pages load instantly, even on slow mobile networks.", "icon": "car", "color": "red", "link": "/"},' || '{"title": "Beautiful", "description": "Uses pre-defined components that look professional.", "icon": "eye", "color": "green", "link": "/"},' || '{"title": "Easy", "description_md": "You can teach yourself enough SQL to use [**SQLPage**](https://sql-page.com) in a weekend.", "icon": "sofa", "color": "blue", "link": "/"}' || ']' - ) - ), - ( - 'hero', - 'A hero with a video', - json( - '[{ - "component":"hero", - "title": "Databases", - "reverse": true, - "description_md": "# “The goal is to turn data into information, and information into insight.”", - "poster": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Lac_de_Zoug.jpg/1280px-Lac_de_Zoug.jpg", - "video": "/sqlpage_introduction_video.mp4" - }]') - ); \ No newline at end of file diff --git a/examples/official-site/sqlpage/migrations/31_card_docs_update.sql b/examples/official-site/sqlpage/migrations/31_card_docs_update.sql index 3046dcd7d..8da39f24f 100644 --- a/examples/official-site/sqlpage/migrations/31_card_docs_update.sql +++ b/examples/official-site/sqlpage/migrations/31_card_docs_update.sql @@ -1,93 +1 @@ DELETE FROM component WHERE name = 'card'; - -INSERT INTO component(name, icon, description) VALUES - ('card', 'credit-card', 'A grid where each element is a small card that displays a piece of data.'); -INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'card', * FROM (VALUES - -- top level - ('title', 'Text header at the top of the list of cards.', 'TEXT', TRUE, TRUE), - ('description', 'A short paragraph displayed below the title.', 'TEXT', TRUE, TRUE), - ('description_md', 'A short paragraph displayed below the title - formatted using markdown.', 'TEXT', TRUE, TRUE), - ('columns', 'The number of columns in the grid of cards. This is just a hint, the grid will adjust dynamically to the user''s screen size, rendering fewer columns if needed to fit the contents. To control the size of cards individually, use the `width` row-level property instead.', 'INTEGER', TRUE, TRUE), - -- item level - ('title', 'Name of the card, displayed at the top.', 'TEXT', FALSE, FALSE), - ('description', 'The body of the card, where you put the main text contents of the card. - This does not support rich text formatting, only plain text. - If you want to use rich text formatting, use the `description_md` property instead.', 'TEXT', FALSE, TRUE), - ('description_md', ' - The body of the card, in Markdown format. - This is useful if you want to display a lot of text in the card, with many options for formatting, such as - line breaks, **bold**, *italics*, lists, #titles, [links](target.sql), ![images](photo.jpg), etc.', 'TEXT', FALSE, TRUE), - ('top_image', 'The URL (absolute or relative) of an image to display at the top of the card.', 'URL', FALSE, TRUE), - ('top_image_lazy', 'Whether the top image must be lazily loaded. Defaults to false, meaning eagerly loaded.', 'BOOLEAN', FALSE, TRUE), - ('top_image_width', 'Specify the top image width, in pixels. Helps prevent layout shifts.', 'INTEGER', FALSE, TRUE), - ('top_image_height', 'Specify the top image height, in pixels. Helps prevent layout shifts.', 'INTEGER', FALSE, TRUE), - ('footer', 'Muted text to display at the bottom of the card.', 'TEXT', FALSE, TRUE), - ('footer_md', 'Muted text to display at the bottom of the card, with rich text formatting in Markdown format.', 'TEXT', FALSE, TRUE), - ('link', 'An URL to which the user should be taken when they click on the card.', 'URL', FALSE, TRUE), - ('target', 'Where the card''s link opens: "_blank" for a new tab, "_self" for the same tab, "_parent" for the parent frame, or "_top" for the full body of the window.', 'TEXT', FALSE, TRUE), - ('footer_link', 'An URL to which the user should be taken when they click on the footer.', 'URL', FALSE, TRUE), - ('style', 'Inline style property to your iframe embed code. For example "background-color: #FFFFFF"', 'TEXT', FALSE, TRUE), - ('height', 'Height of the iframe embed code, in pixels. Used only when embed_mode is ''iframe''.', 'INTEGER', FALSE, TRUE), - ('allow', 'The permissions policy of the iframe embed code, for instance "fullscreen; clipboard-write". Used only when embed_mode is ''iframe''.', 'TEXT', FALSE, TRUE), - ('sandbox', 'The restrictions to apply to the iframe embed code, for instance "allow-scripts allow-same-origin". Used only when embed_mode is ''iframe''.', 'TEXT', FALSE, TRUE), - ('icon', 'Name of an icon to display on the right side of the card.', 'ICON', FALSE, TRUE), - ('color', 'The name of a color, to be displayed on the left of the card to highlight it. If the embed parameter is enabled and you don''t have a title or description, this parameter won''t apply.', 'COLOR', FALSE, TRUE), - ('background_color', 'The background color of the card.', 'COLOR', FALSE, TRUE), - ('active', 'Whether this item in the grid is considered "active". Active items are displayed more prominently.', 'BOOLEAN', FALSE, TRUE), - ('width', 'The width of the card, between 1 (smallest) and 12 (full-width). The default width is 3, resulting in 4 cards per line. When embed_mode is ''iframe'', this is used as the width of the iframe instead, and defaults to 100%.', 'INTEGER', FALSE, TRUE) -) x; -INSERT INTO parameter(component, name, description_md, type, top_level, optional) SELECT 'card', * FROM (VALUES - ('embed', 'A url whose contents will be fetched and injected into the body of this card. - This can be used to inject arbitrary html content, but is especially useful for injecting - the output of other sql files rendered by SQLPage. For the latter case you can pass the - `?_sqlpage_embed` query parameter, which will skip the shell layout. - Components inside the fetched content initialize automatically. Custom scripts that insert - SQLPage fragments should dispatch a bubbling `fragment-loaded` event on the element containing - the new content. Initialization includes that element and its descendants; dispatching the - event on `document` initializes pending components throughout the page. Repeated events - preserve existing form and widget handlers', 'TEXT', FALSE, TRUE), - ('embed_mode', 'Set to ''iframe'' to embed the target (specified through embed property) in an iframe. - Unless this is explicitly set, the embed target is fetched and injected within the parent page. If embed_mode is set to iframe, - You can also set height and width parameters to configure the appearance and the sandbox and allow parameters to configure - security aspects of the iframe. Refer to the [MDN page](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) - for an explanation of these parameters.', 'TEXT', FALSE, TRUE) -) x; - -INSERT INTO example(component, description, properties) VALUES - ('card', 'A beautiful card grid with bells and whistles, showing examples of SQLPage features.', - json('[{"component":"card", "title":"Popular SQLPage features", "columns": 2}, - {"title": "Download as spreadsheet", "link": "?component=csv#component", "description": "Using the CSV component, you can download your data as a spreadsheet.", "icon":"file-plus", "color": "green", "footer_md": "SQLPage can both [read](?component=form#component) and [write](?component=csv#component) **CSV** files."}, - {"title": "Custom components", "link": "/custom_components.sql", "description": "If you know some HTML, you can create your own components for your application.", "icon":"code", "color": "orange", "footer_md": "You can look at the [source of the official components](https://github.com/sqlpage/SQLPage/tree/main/sqlpage/templates) for inspiration."} - ]')), - ('card', 'You can use cards to display a dashboard with quick access to important information. Use [markdown](https://www.markdownguide.org/basic-syntax) to format the text.', - json('[ - {"component": "card", "columns": 4}, - {"description_md": "**152** sales today", "active": true, "icon": "currency-euro"}, - {"description_md": "**13** new users", "icon": "user-plus", "color": "green"}, - {"description_md": "**2** complaints", "icon": "alert-circle", "color": "danger", "link": "?view_complaints", "background_color": "red-lt"}, - {"description_md": "**1** pending support request", "icon": "mail-question", "color": "warning"} - ]')), - ('card', 'A gallery of images.', - json('[ - {"component":"card", "title":"My favorite animals in pictures", "columns": 3}, - {"title": "Lynx", "description_md": "The **lynx** is a medium-sized **wild cat** native to Northern, Central and Eastern Europe to Central Asia and Siberia, the Tibetan Plateau and the Himalayas.", "top_image_alt": "A Eurasian lynx", "top_image": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Lynx_lynx_-_05.jpg/330px-Lynx_lynx_-_05.jpg", "top_image_width": 330, "top_image_height": 495, "top_image_lazy": true, "icon":"star" }, - {"title": "Squirrel", "description_md": "The **chipmunk** is a small, striped rodent of the family Sciuridae. Chipmunks are found in North America, with the exception of the Siberian chipmunk which is found primarily in Asia.", "top_image_alt": "A squirrel eating a nut", "top_image": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/American_squirrel_eating_nut%2C_13_Jun_2013.JPG/330px-American_squirrel_eating_nut%2C_13_Jun_2013.JPG", "top_image_width": 330, "top_image_height": 495, "top_image_lazy": true }, - {"title": "Spider", "description_md": "The **jumping spider family** (_Salticidae_) contains more than 600 described genera and about *6000 described species*, making it the largest family of spiders with about 13% of all species.", "top_image_alt": "An orb weaver spinning a web", "top_image": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Australian_orb_weaver_spinning_web.jpg/330px-Australian_orb_weaver_spinning_web.jpg", "top_image_width": 330, "top_image_height": 495, "top_image_lazy": true } - ]')), - ('card', 'Beautifully colored cards with variable width. The blue card (width 6) takes half the screen, whereas of the red and green cards have the default width of 3', - json('[ - {"component":"card", "title":"Beautifully colored cards" }, - {"title": "Red card", "color": "red", "background_color": "red-lt", "description": "Penalty! You are out!", "icon":"play-football" }, - {"title": "Blue card", "color": "blue", "width": 6, "background_color": "blue-lt", "description": "The Blue Card facilitates migration of foreigners to Europe.", "icon":"currency-euro" }, - {"title": "Green card", "color": "green", "background_color": "green-lt", "description": "Welcome to the United States of America !", "icon":"user-dollar" } - ]')), - ('card', 'The first card embeds a SQLPage chart as a page fragment. The second embeds a video player in an iframe with its own `height` and `allow` attributes.', - json('[ - {"component":"card", "title":"Card with embedded remote content", "columns": 2}, - {"title": "Embedded Chart", "embed": "/examples/chart.sql" }, - {"title": "Embedded Video", "embed": "https://www.youtube.com/embed/mXdgmSdaXkg", "allow": "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share", "embed_mode": "iframe", "height": "350" } - ]')); - -INSERT INTO parameter(component, name, description, type, top_level, optional) VALUES - ('card', 'top_image_alt', 'Alternative text for an informative card image. Leave empty if decorative.', 'TEXT', FALSE, TRUE), - ('card', 'embed_title', 'Accessible name of the iframe. Defaults to the card title, or Embedded content if no title is set.', 'TEXT', FALSE, TRUE); diff --git a/examples/official-site/sqlpage/migrations/34_carousel.sql b/examples/official-site/sqlpage/migrations/34_carousel.sql deleted file mode 100644 index 70f74b53b..000000000 --- a/examples/official-site/sqlpage/migrations/34_carousel.sql +++ /dev/null @@ -1,163 +0,0 @@ -INSERT INTO component (name, description, icon, introduced_in_version) -VALUES ( - 'carousel', - 'A carousel is used to display images. When used with multiple images, it will cycle through them automatically or with controls, creating a slideshow.', - 'carousel-horizontal', - '0.18.3' - ); -INSERT INTO parameter ( - component, - name, - description, - type, - top_level, - optional - ) -VALUES - ( - '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. Default is 12.', - 'INTEGER', - TRUE, - TRUE - ), - ( - 'carousel', - 'auto', - 'Whether to automatically cycle through the carousel items. Default is false.', - 'BOOLEAN', - TRUE, - TRUE - ), - ( - 'carousel', - 'center', - 'Whether to center the carousel.', - 'BOOLEAN', - TRUE, - TRUE - ), - ( - 'carousel', - 'fade', - 'Whether to apply the fading effect.', - 'BOOLEAN', - TRUE, - TRUE - ), - ( - 'carousel', - 'delay', - 'Specify the delay, in milliseconds, between two images.', - 'INTEGER', - 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 - ), - ( - 'carousel', - 'width', - 'The width of the image, in pixels.', - 'INTEGER', - FALSE, - TRUE - ), - ( - 'carousel', - 'height', - 'The height of the image, in pixels.', - 'INTEGER', - FALSE, - TRUE - ); -INSERT INTO parameter(component, name, description, type, top_level, optional) VALUES - ('carousel', 'image_alt', 'Alternative text describing the slide image. Leave empty if the image is decorative or its caption already describes it.', '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":"Famous Database Animals"}, - {"image_alt":"African elephants at a watering hole","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/1280px-Elefantes_africanos_de_sabana_%28Loxodonta_africana%29%2C_Elephant_Sands%2C_Botsuana%2C_2018-07-28%2C_DD_114-117_PAN.jpg"}, - {"image_alt":"A panoramic view of Penguin Island","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"} - ]' - ) - ), - ( - 'carousel', - 'An advanced example of carousel with controls', - JSON( - '[ - {"component":"carousel","title":"SQL web apps","width":10, "center":true,"controls":true,"auto":true}, - {"image":"/sqlpage_cover_image.webp","title":"SQLPage is modern","description":"Built by engineers who have built so many web applications the old way, they decided they just wouldn''t anymore.", "height": 512}, - {"image":"/sqlpage_illustration_alien.webp","title":"SQLPage is easy", "description":"SQLPage connects to your database, then it turns your SQL queries into nice websites.", "height": 512} - ]' - ) - ); diff --git a/examples/official-site/sqlpage/migrations/82_reference_catalog.sql b/examples/official-site/sqlpage/migrations/82_reference_catalog.sql index 45ba097f2..82bf65654 100644 --- a/examples/official-site/sqlpage/migrations/82_reference_catalog.sql +++ b/examples/official-site/sqlpage/migrations/82_reference_catalog.sql @@ -26,15 +26,12 @@ ALTER TABLE sqlpage_functions ADD COLUMN catalog_summary TEXT; ALTER TABLE sqlpage_function_parameters ADD COLUMN optional BOOLEAN NOT NULL DEFAULT FALSE; WITH copy(name, category, summary) AS (VALUES - ('card', 'display-data', 'Arrange records in cards with images, links, or embedded content.'), - ('carousel', 'display-data', 'Show a slideshow of images with optional captions and controls.'), ('map', 'display-data', 'Plot locations and geographic shapes on an interactive map.'), ('timeline', 'display-data', 'Arrange events along a vertical timeline.'), ('tracking', 'display-data', 'Show a sequence of activity or status changes as colored segments.'), - ('hero', 'page-layout', 'Introduce a page with a headline, media, and a call to action.'), ('cookie', 'http-responses', 'Set a cookie in the visitor''s browser.'), ('csv', 'http-responses', 'Export query rows as a downloadable CSV file.'), diff --git a/examples/official-site/sqlpage/migrations/99_shared_id_class_attributes.sql b/examples/official-site/sqlpage/migrations/99_shared_id_class_attributes.sql index 24d15832e..752223634 100644 --- a/examples/official-site/sqlpage/migrations/99_shared_id_class_attributes.sql +++ b/examples/official-site/sqlpage/migrations/99_shared_id_class_attributes.sql @@ -13,25 +13,19 @@ INSERT INTO parameter(component, top_level, name, description, type, optional) SELECT *, 'id', 'id attribute added to the container in HTML. It can be used to target this item through css or for scrolling to this item through links (use "#id" in link url).', 'TEXT', TRUE FROM (VALUES - ('card', FALSE), ('csv', TRUE), - ('hero', TRUE), ('map', TRUE), ('timeline', TRUE), ('timeline', FALSE), - ('tracking', TRUE), - ('carousel', TRUE) + ('tracking', TRUE) ); INSERT INTO parameter(component, top_level, name, description, type, optional) SELECT *, 'class', 'class attribute added to the container in HTML. It can be used to apply custom styling to this item through css. Added in v0.18.0.', 'TEXT', TRUE FROM (VALUES - ('card', TRUE), - ('card', FALSE), ('csv', TRUE), ('map', TRUE), ('timeline', TRUE), ('timeline', FALSE), - ('tracking', TRUE), - ('carousel', TRUE) + ('tracking', TRUE) );