Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions examples/official-site/content/components/breadcrumb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
icon: dots
since: 0.18.0
category: navigation
summary: Link the current page to its parent pages.
top:
- class
- id
row:
- name: active
type: TEXT
description: Whether the link is active or not. Defaults to false.
- name: description
type: TEXT
description: Description of the link. This is displayed when the user hovers over the link.
- name: link
type: TEXT
description: Link to the page to display when the link is clicked. By default, the link refers to the current
page, with a 'link' parameter set to the link's title.
- name: title
type: TEXT
required: true
description: Hyperlink text to display.
---

A secondary navigation aid that helps users understand their location on a website or mobile application.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
rows:
- component: breadcrumb
- title: Home
link: /
- title: Components
link: /documentation.sql
- title: Breadcrumb
link: ?component=breadcrumb
---

Basic usage of the breadcrumb component
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
rows:
- component: breadcrumb
- title: Home
link: /
active: true
- title: Articles
link: /blog.sql
description: Stay informed with the latest news
- title: JSON in SQL
link: /blog.sql?post=JSON%20in%20SQL%3A%20A%20Comprehensive%20Guide
description: Learn advanced json functions for MySQL, SQLite, PostgreSQL, and SQL Server
---

Description of a link and selection of the current page.
37 changes: 37 additions & 0 deletions examples/official-site/content/components/status_bar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
icon: layout-bottombar
since: 0.49.0
category: navigation
summary: Show status messages and links in a horizontal bar.
top:
- class
- name: fixed
type: BOOLEAN
description: Keep the bar at the bottom of the screen while the page scrolls. Defaults to true. A fixed
bar overlays page content, so leave space below your last item if needed. Set to false to place the bar
in the page where the SQL appears.
- id
- name: label
type: TEXT
description: Accessible name for the bar. Defaults to "Status bar".
row:
- class
- name: color
type: COLOR
description: Color of the segment text and icon.
- name: icon
type: ICON
description: Icon displayed before the text.
- name: link
type: URL
description: URL to open when the segment is clicked.
- name: title
type: TEXT
description: Text displayed in the segment.
- name: tooltip
type: TEXT
description: Text shown when hovering over the segment or focusing its link. For an icon without a title,
supply a tooltip to give the segment an accessible name.
---

Display short status messages and links in a single horizontal bar. Each row adds one segment. When there are several segments, the last one aligns to the far edge. If the segments do not all fit, scroll the bar horizontally to see the rest.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
rows:
- component: status_bar
label: Query status
fixed: false
- title: Connected
icon: database
color: green
tooltip: Connected to the reporting database
- title: 24 rows
- title: SQL functions
icon: book
link: /functions.sql
---

A query workspace shows the database connection, row count, and a link to the function reference. Omit `fixed` to pin this bar to the bottom of the screen.
40 changes: 40 additions & 0 deletions examples/official-site/content/components/steps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
icon: dots-circle-horizontal
category: navigation
summary: Mark progress through the stages of a task.
top:
- name: color
type: COLOR
description: Color of the bars displayed between steps.
- name: counter
type: TEXT
description: Display the number of the step on top of its name.
- name: description
type: TEXT
description: Description of the section.
- name: id
type: TEXT
description: id attribute injected as an anchor in HTML. It can be used for scrolling to this item through
links (use "#id" in link url). Added in v0.18.0.
- name: title
type: TEXT
description: Title of the section.
row:
- name: active
type: BOOLEAN
description: Whether this item in the grid is considered "active". Active items are displayed more prominently.
- name: description
type: TEXT
description: Tooltip to display when the user passes their mouse over the step's name.
- name: icon
type: ICON
description: An icon name (from tabler-icons.io) to display on the left side of the step name.
- name: link
type: URL
description: A target URL to which the user should be taken when they click on the step.
- name: title
type: TEXT
description: Name of the step.
---

Guide users through multi-stage processes, displaying a clear list of previous and future steps.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
rows:
- component: steps
- title: Shopping
- title: Store pickup
- title: Payment
active: true
- title: Review & Order
---

Online store checkout steps.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
rows:
- component: steps
counter: true
color: purple
- title: Registration form
icon: forms
link: https://github.com/sqlpage/SQLPage
description: Initial account data creation.
- title: Email confirmation
icon: mail
link: https://sql-page.com
description: Confirm your email by clicking on a link in a validation email.
- title: ID verification
description: Checking personal information
icon: user
link: '#'
- title: Final account approval
description: ophir.dev
link: https://ophir.dev/
icon: eye-check
active: true
- title: Account creation
icon: check
---

A progress indicator with custom color, auto-generated step numbers, icons, and description tooltips.
43 changes: 43 additions & 0 deletions examples/official-site/content/components/tab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
icon: row-insert-bottom
since: 0.9.5
category: navigation
summary: Switch between related pages using labeled tabs.
top:
- name: center
type: BOOLEAN
description: Whether the tabs should be centered or not. Defaults to false.
- class
- id
row:
- name: active
type: BOOLEAN
description: Whether the tab is active or not. Defaults to false.
- name: center
type: BOOLEAN
description: Whether this individual tab's label should be centered inside the tab. Defaults to false.
- class
- name: color
type: TEXT
description: Color of the tab's text, and of its underline when it is active. See preview.tabler.io/colors.html
for a list of available colors.
- name: description
type: TEXT
description: Description of the tab. This is displayed when the user hovers over the tab.
- name: icon
type: TEXT
description: Name of the icon to display on the tab. See tabler-icons.io for a list of available icons.
- id
- name: link
type: TEXT
description: Link to the page to display when the tab is clicked. By default, the link refers to the current
page, with a 'tab' parameter set to the tab's title and hash set to the id (if passed) - this brings
us back to the location of the tab after submission.
- name: title
type: TEXT
required: true
description: Text to display on the tab. If link is not set, the link will be the current page with a '$tab'
parameter set to the tab's title. If 'id' is set, the page will be scrolled to the tab.
---

Build a tabbed interface, with each tab being a link to a page. Each tab can be in two states: active or inactive.
35 changes: 35 additions & 0 deletions examples/official-site/content/components/tab/examples/01-basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
rows:
- component: tab
- title: This tab does not exist
active: true
link: ?component=tab&tab=tab_1
- title: I am not a true tab
link: ?component=tab&tab=tab_2
- title: Do not click here
link: ?component=tab&tab=tab_3
---

This example shows a very basic set of three tabs. The first tab is active. You could use this at the top of a page for easy navigation.

To implement contents that change based on the active tab, use the `tab` parameter in the page query string.
For example, if the page is `/my-page.sql`, then the first tab will have a link of `/my-page.sql?tab=My+First+tab`.

You could then for instance display contents coming from the database based on the value of the `tab` parameter.
For instance: `SELECT 'text' AS component, contents_md FROM my_page_contents WHERE tab = $tab`.
Or you could write different queries for different tabs and use the `$tab` parameter with a static value in a where clause to switch between tabs:

```sql
set tab = coalesce($tab, 'Projects');
select 'tab' as component;
select 'Projects' as title, $tab = 'Projects' as active;
select 'Tasks' as title, $tab = 'Tasks' as active;

select 'table' as component;

select * from my_projects where $tab = 'Projects';
select * from my_tasks where $tab = 'Tasks';
```

Note that the example below is completely static, and does not use the `tab` parameter to actually switch between tabs.
The query above defaults to Projects on the first visit; the links then select either `?tab=Projects` or `?tab=Tasks`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
rows:
- component: tab
center: true
- title: Hero
link: ?component=hero#component
icon: home
description: The hero component is a full-width banner with a title and an image.
- title: Tab
link: ?component=tab#component
icon: user
color: purple
- title: Card
link: ?component=card#component
icon: credit-card
---

This example shows a more sophisticated set of tabs. The tabs are centered, the active tab has a different color, and all the tabs have a custom link and icon.
27 changes: 0 additions & 27 deletions examples/official-site/sqlpage/migrations/01_documentation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,6 @@ INSERT INTO example(component, description, properties) VALUES
{"title": "Encyclopedia", "link":"https://wikipedia.org", "description": "Wikipedia", "color": "blue", "icon":"world", "footer": "Owned by the Wikimedia Foundation"}
]'));


INSERT INTO component(name, icon, description) VALUES
('steps', 'dots-circle-horizontal', 'Guide users through multi-stage processes, displaying a clear list of previous and future steps.');
INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'steps', * FROM (VALUES
-- top level
('color', 'Color of the bars displayed between steps.', 'COLOR', TRUE, TRUE),
('counter', 'Display the number of the step on top of its name.', 'TEXT', TRUE, TRUE),
('title', 'Title of the section.', 'TEXT', TRUE, TRUE),
('description', 'Description of the section.', 'TEXT', TRUE, TRUE),
-- item level
('title', 'Name of the step.', 'TEXT', FALSE, TRUE),
('description', 'Tooltip to display when the user passes their mouse over the step''s name.', 'TEXT', FALSE, TRUE),
('link', 'A target URL to which the user should be taken when they click on the step.', 'URL', FALSE, TRUE),
('icon', 'An icon name (from tabler-icons.io) to display on the left side of the step name.', 'ICON', FALSE, TRUE),
('active', 'Whether this item in the grid is considered "active". Active items are displayed more prominently.', 'BOOLEAN', FALSE, TRUE)
) x;

INSERT INTO example(component, description, properties) VALUES
('steps', 'Online store checkout steps.', json('[{"component":"steps"},{"title":"Shopping"},{"title":"Store pickup"}, {"title":"Payment","active":true},{"title":"Review & Order"}]')),
('steps', 'A progress indicator with custom color, auto-generated step numbers, icons, and description tooltips.',
json('[{"component":"steps", "counter": true, "color":"purple"}, '||
'{"title": "Registration form", "icon":"forms", "link": "https://github.com/sqlpage/SQLPage", "description": "Initial account data creation."},' ||
'{"title": "Email confirmation", "icon": "mail", "link": "https://sql-page.com", "description": "Confirm your email by clicking on a link in a validation email."},' ||
'{"title": "ID verification", "description": "Checking personal information", "icon": "user", "link": "#"},' ||
'{"title": "Final account approval", "description": "ophir.dev", "link": "https://ophir.dev/", "icon":"eye-check", "active": true},' ||
'{"title":"Account creation", "icon":"check"}]'));

INSERT INTO component(name, icon, description) VALUES
('chart', 'timeline', 'A component that plots data. Line, area, bar, and pie charts are all supported. Each item in the component is a data point in the graph.');

Expand Down
Loading
Loading