@qhealth-design-system/core 1.18.3 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/assets/accordion-js.js +344 -0
- package/.storybook/assets/animate-js.js +247 -0
- package/.storybook/assets/index.js +15 -0
- package/.storybook/globals.js +39 -41
- package/.storybook/main.js +4 -3
- package/.storybook/preview.js +11 -13
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/package.json +10 -15
- package/src/component-loader.js +23 -0
- package/src/components/_global/css/body/component.scss +3 -3
- package/src/components/_global/css/btn/component.scss +1 -1
- package/src/components/_global/css/cta_links/component.scss +2 -2
- package/src/components/_global/css/example/component.scss +11 -19
- package/src/components/_global/css/forms/control_inputs/component.scss +2 -2
- package/src/components/_global/css/forms/general/component.scss +5 -5
- package/src/components/_global/css/headings/component.scss +42 -44
- package/src/components/_global/css/img/images.scss +20 -36
- package/src/components/_global/css/link_columns/component.scss +2 -2
- package/src/components/_global/css/modal/component.scss +20 -26
- package/src/components/_global/css/table/component.scss +14 -21
- package/src/components/_global/css/tabs/component.scss +2 -2
- package/src/components/_global/css/tags/component.scss +1 -1
- package/src/components/_global/css/toggle_and_tool_tip/component.scss +3 -3
- package/src/components/_global/js/global.js +1 -1
- package/src/components/_global/js/select_boxes/global.js +26 -35
- package/src/components/accordion/css/component.scss +289 -326
- package/src/components/banner/css/component.scss +77 -173
- package/src/components/banner/html/component.hbs +2 -4
- package/src/components/banner_advanced/html/component.hbs +2 -2
- package/src/components/banner_advanced/js/manifest.json +1422 -1386
- package/src/components/basic_search/css/component.scss +13 -14
- package/src/components/basic_search/html/component.hbs +11 -20
- package/src/components/breadcrumbs/js/global.js +6 -1
- package/src/components/callout/css/component.scss +37 -40
- package/src/components/card_feature/css/component.scss +28 -167
- package/src/components/card_multi_action/css/component.scss +46 -58
- package/src/components/code/css/component.scss +3 -3
- package/src/components/code/html/component.hbs +12 -12
- package/src/components/code/js/global.js +6 -1
- package/src/components/file_upload/css/component.scss +5 -5
- package/src/components/file_upload/js/global.js +46 -43
- package/src/components/footer/css/component.scss +3 -3
- package/src/components/global_alert/css/component.scss +8 -14
- package/src/components/global_alert/html/component.hbs +3 -3
- package/src/components/header/css/component.scss +16 -4
- package/src/components/header/html/component.hbs +3 -2
- package/src/components/header/js/global.js +8 -1
- package/src/components/in_page_navigation/css/component.scss +14 -16
- package/src/components/in_page_navigation/js/global.js +48 -58
- package/src/components/internal_navigation/css/component.scss +3 -3
- package/src/components/internal_navigation/js/global.js +27 -35
- package/src/components/left_hand_navigation/css/component.scss +8 -2
- package/src/components/main_navigation/css/component.scss +16 -7
- package/src/components/main_navigation/html/component.hbs +1 -0
- package/src/components/mega_main_navigation/css/component.scss +5 -5
- package/src/components/mega_main_navigation/html/component.hbs +1 -0
- package/src/components/pagination/css/component.scss +32 -28
- package/src/components/pagination/html/component.hbs +37 -40
- package/src/components/promo_panel/css/component.scss +1 -4
- package/src/components/promo_panel/html/component.hbs +11 -5
- package/src/components/promo_panel/js/global.js +24 -39
- package/src/components/promo_panel/js/manifest.json +8 -0
- package/src/components/tab/css/component.scss +3 -3
- package/src/components/toggle_tip/css/component.scss +1 -1
- package/src/components/tool_tip/css/component.scss +1 -1
- package/src/components/video_player/js/global.js +16 -13
- package/src/data/current.json +33 -1
- package/src/helpers/global-helpers.js +56 -0
- package/src/html/component-in_page_navigation.html +2 -2
- package/src/index.js +4 -8
- package/src/stories/BackToTop/BackToTop.mdx +3 -21
- package/src/stories/CTALink/CTALink.mdx +1 -4
- package/src/stories/Checkboxes/Checkboxes.mdx +1 -4
- package/src/stories/DirectionLinks/DirectionLinks.mdx +1 -4
- package/src/stories/InPageAlert/InPageAlert.mdx +1 -4
- package/src/stories/Introduction.mdx +9 -5
- package/src/stories/LinkColumns/LinkColumns.mdx +1 -4
- package/src/stories/Pagination/Pagination.mdx +26 -0
- package/src/stories/Pagination/Pagination.stories.js +257 -0
- package/src/stories/PromoPanel/PromoPanel.mdx +26 -0
- package/src/stories/PromoPanel/PromoPanel.stories.js +219 -0
- package/src/stories/RadioButtons/RadioButtons.mdx +1 -4
- package/src/stories/SelectBox/SelectBox.mdx +1 -4
- package/src/stories/Tags/Tags.js +3 -3
- package/src/stories/Tags/Tags.mdx +1 -4
- package/src/stories/VideoPlayer/VideoPlayer.mdx +3 -28
- package/src/stories/VideoPlayer/VideoPlayer.stories.js +19 -46
- package/src/styles/imports/utilities.scss +3 -3
- package/src/styles/imports/variables.scss +5 -0
- package/src/stories/VideoPlayer/VideoPlayer.js +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module VideoPlayer
|
|
3
|
+
*/
|
|
3
4
|
|
|
5
|
+
export default function initVideoPlayer(document = document) {
|
|
4
6
|
// Select all accordion title buttons
|
|
5
|
-
const accordionTitles = document.querySelectorAll(
|
|
6
|
-
|
|
7
|
+
const accordionTitles = document.querySelectorAll(".qld__body .qld__video__player--wrapper .qld__accordion__title");
|
|
7
8
|
if (!accordionTitles.length) return;
|
|
8
9
|
|
|
9
|
-
accordionTitles.forEach(
|
|
10
|
-
accordionTitle.addEventListener(
|
|
11
|
-
|
|
12
|
-
const buttonText = this.querySelector('i').nextSibling;
|
|
13
|
-
|
|
14
|
-
buttonText.textContent = accordionTitle.classList.contains('qld__accordion--open')
|
|
15
|
-
? "Show transcript"
|
|
16
|
-
: "Hide transcript";
|
|
10
|
+
accordionTitles.forEach((accordionTitle) => {
|
|
11
|
+
accordionTitle.addEventListener("click", () => {
|
|
12
|
+
toggleButtonState(accordionTitle);
|
|
17
13
|
});
|
|
18
14
|
});
|
|
19
|
-
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function toggleButtonState(accordionTitle) {
|
|
18
|
+
// Toggle the text content based on the accordion state
|
|
19
|
+
const buttonSpan = accordionTitle.querySelector("svg").nextElementSibling;
|
|
20
|
+
const isCurrentlyOpen = accordionTitle.classList.contains("qld__accordion--open");
|
|
21
|
+
buttonSpan.textContent = isCurrentlyOpen ? "Show transcript" : "Hide transcript";
|
|
22
|
+
}
|
package/src/data/current.json
CHANGED
|
@@ -541,7 +541,23 @@
|
|
|
541
541
|
"asset_url": "/inner.html",
|
|
542
542
|
"asset_name": "Inner",
|
|
543
543
|
"asset_short_name": "Inner",
|
|
544
|
-
"children": [
|
|
544
|
+
"children": [
|
|
545
|
+
{
|
|
546
|
+
"asset_assetid": "test1",
|
|
547
|
+
"asset_url": "/test1.html",
|
|
548
|
+
"asset_name": "Test1",
|
|
549
|
+
"asset_short_name": "Test1",
|
|
550
|
+
"children": [
|
|
551
|
+
{
|
|
552
|
+
"asset_assetid": "test2",
|
|
553
|
+
"asset_url": "/test2.html",
|
|
554
|
+
"asset_name": "Test2",
|
|
555
|
+
"asset_short_name": "Test2",
|
|
556
|
+
"children": []
|
|
557
|
+
}
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
]
|
|
545
561
|
}
|
|
546
562
|
],
|
|
547
563
|
"lineage": [
|
|
@@ -568,6 +584,22 @@
|
|
|
568
584
|
"asset_is_site_asset": "0",
|
|
569
585
|
"asset_url": "https://qhscb.squiz.cloud/design/components",
|
|
570
586
|
"asset_type_code": "page_standard"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
"asset_assetid": "test1",
|
|
590
|
+
"asset_name": "Components",
|
|
591
|
+
"asset_short_name": "Components",
|
|
592
|
+
"asset_is_site_asset": "0",
|
|
593
|
+
"asset_url": "https://qhscb.squiz.cloud/design/components",
|
|
594
|
+
"asset_type_code": "page_standard"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"asset_assetid": "test2",
|
|
598
|
+
"asset_name": "Components",
|
|
599
|
+
"asset_short_name": "Components",
|
|
600
|
+
"asset_is_site_asset": "0",
|
|
601
|
+
"asset_url": "https://qhscb.squiz.cloud/design/components",
|
|
602
|
+
"asset_type_code": "page_standard"
|
|
571
603
|
}
|
|
572
604
|
],
|
|
573
605
|
"top": {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Validate that the SVG path has the correct extension and is same-origin
|
|
2
|
+
export const validateInternalSvgPath = (path) => {
|
|
3
|
+
let shouldValidate = true;
|
|
4
|
+
|
|
5
|
+
// Check given path is a string
|
|
6
|
+
if (typeof path !== "string") {
|
|
7
|
+
console.error(`Path provided is not a string. ${path}.`);
|
|
8
|
+
shouldValidate = false;
|
|
9
|
+
return shouldValidate;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const trimmed = path.trim();
|
|
13
|
+
|
|
14
|
+
// Reject dangerous schemes or characters
|
|
15
|
+
if (trimmed.includes("javascript:") || trimmed.includes("data:") || trimmed.includes("vbscript:")) {
|
|
16
|
+
console.error(`Path contains potentially dangerous scheme. ${path}.`);
|
|
17
|
+
shouldValidate = false;
|
|
18
|
+
return shouldValidate;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const url = new URL(trimmed, window.location.origin);
|
|
22
|
+
const filePath = url.searchParams.get("a"); // Extracts asset path from query parameter
|
|
23
|
+
|
|
24
|
+
// Ensure same-origin
|
|
25
|
+
if (url.origin !== window.location.origin) {
|
|
26
|
+
console.error(`The SVG path comes from a different origin: ${url.origin} but expected ${window.location.origin}`);
|
|
27
|
+
shouldValidate = false;
|
|
28
|
+
return shouldValidate;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Only allow simple path characters and .svg extension
|
|
32
|
+
if (!/^\d+:[a-z0-9/_-]+\.svg$/i.test(filePath)) {
|
|
33
|
+
console.error(`The SVG path is invalid: ${filePath}`);
|
|
34
|
+
shouldValidate = false;
|
|
35
|
+
return shouldValidate;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return shouldValidate;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const buildIconPath = (path, icon) => {
|
|
42
|
+
try {
|
|
43
|
+
const url = new URL(path, window.location.origin);
|
|
44
|
+
if (icon) {
|
|
45
|
+
url.hash = icon;
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Remove all special characters
|
|
54
|
+
export const normaliseIdentifier = (string) => {
|
|
55
|
+
return string.replace(/[^a-z0-9]+/g, "");
|
|
56
|
+
};
|
|
@@ -566,8 +566,8 @@
|
|
|
566
566
|
${require('../components/_global/html/component.hbs')({ "manifest":require('../components/in_page_navigation/js/manifest.json'), "callback": "QLD.inPageNav.init",
|
|
567
567
|
"component":require('!url-loader!../components/in_page_navigation/html/component.hbs'), "component_output":require('../components/in_page_navigation/html/component.hbs')({
|
|
568
568
|
"component":require('../components/in_page_navigation/js/manifest.json').component, "content":"Lorem Ipsum" }) })}
|
|
569
|
-
<div id="content" style="display:
|
|
570
|
-
<h2>Heading 2.1</h2>
|
|
569
|
+
<div id="content" style="display: block">
|
|
570
|
+
<h2>Heading 2.""//**1</h2>
|
|
571
571
|
<p>Lorem ipsum dolor</p>
|
|
572
572
|
|
|
573
573
|
<h2>Heading 2.2</h2>
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import initHeader from "./components/header/js/global.js";
|
|
2
|
-
import initLeftHandNav from "./components/left_hand_navigation/js/global.js";
|
|
3
|
-
|
|
4
1
|
// JS
|
|
5
|
-
|
|
2
|
+
import initComponents from "./component-loader.js";
|
|
3
|
+
import "../src/helpers/global-helpers.js";
|
|
4
|
+
import "prismjs";
|
|
6
5
|
|
|
7
6
|
// Adding ES module initialisation for components
|
|
8
|
-
|
|
9
|
-
initHeader(document);
|
|
10
|
-
initLeftHandNav(document);
|
|
11
|
-
});
|
|
7
|
+
initComponents();
|
|
12
8
|
|
|
13
9
|
// CSS
|
|
14
10
|
import "./styles/global.scss";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Canvas, Story } from "@storybook/blocks";
|
|
1
|
+
import { Meta, Canvas, Story } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as BackToTopStories from "./BackToTop.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -16,27 +16,9 @@ The 'back to top' button, is a small button placed at the end of the page on the
|
|
|
16
16
|
|
|
17
17
|
## Design resources
|
|
18
18
|
|
|
19
|
-
- <a
|
|
20
|
-
className="figma-link"
|
|
21
|
-
href={figmaLinks.backToTop.design}
|
|
22
|
-
target="_blank"
|
|
23
|
-
rel="noopener noreferrer"
|
|
24
|
-
>
|
|
19
|
+
- <a className="figma-link" href={figmaLinks.backToTop.design} target="_blank" rel="noopener noreferrer">
|
|
25
20
|
Component design view (Figma)
|
|
26
21
|
</a>
|
|
27
|
-
- <a
|
|
28
|
-
className="figma-link"
|
|
29
|
-
href={figmaLinks.backToTop.file}
|
|
30
|
-
target="_blank"
|
|
31
|
-
rel="noopener noreferrer"
|
|
32
|
-
>
|
|
33
|
-
Component file (Figma)
|
|
34
|
-
</a>
|
|
35
|
-
- <a
|
|
36
|
-
className="figma-link"
|
|
37
|
-
href={figmaLinks.backToTop.ds}
|
|
38
|
-
target="_blank"
|
|
39
|
-
rel="noopener noreferrer"
|
|
40
|
-
>
|
|
22
|
+
- <a className="figma-link" href={figmaLinks.backToTop.ds} target="_blank" rel="noopener noreferrer">
|
|
41
23
|
Design System website
|
|
42
24
|
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Primary, Controls, Story, Source } from "@storybook/blocks";
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as CTALink from "./CTALink.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -31,9 +31,6 @@ In our Design System we have 2 styles, a default and view all.
|
|
|
31
31
|
- <a className="figma-link" href={figmaLinks.ctaLink.design} target="_blank" rel="noopener noreferrer">
|
|
32
32
|
Component design view (Figma)
|
|
33
33
|
</a>
|
|
34
|
-
- <a className="figma-link" href={figmaLinks.ctaLink.file} target="_blank" rel="noopener noreferrer">
|
|
35
|
-
Component file (Figma)
|
|
36
|
-
</a>
|
|
37
34
|
- <a className="figma-link" href={figmaLinks.ctaLink.ds} target="_blank" rel="noopener noreferrer">
|
|
38
35
|
Design System website
|
|
39
36
|
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Primary, Controls, Story, Source } from "@storybook/blocks";
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as checkboxesStories from "./Checkboxes.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -37,9 +37,6 @@ Disabled control inputs can be used to indicate inputs that are no longer valid
|
|
|
37
37
|
- <a className="figma-link" href={figmaLinks.checkboxes.design} target="_blank" rel="noopener noreferrer">
|
|
38
38
|
Component design view (Figma)
|
|
39
39
|
</a>
|
|
40
|
-
- <a className="figma-link" href={figmaLinks.checkboxes.file} target="_blank" rel="noopener noreferrer">
|
|
41
|
-
Component file (Figma)
|
|
42
|
-
</a>
|
|
43
40
|
- <a className="figma-link" href={figmaLinks.checkboxes.ds} target="_blank" rel="noopener noreferrer">
|
|
44
41
|
Design System website
|
|
45
42
|
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Primary, Controls, Story, Source } from "@storybook/blocks";
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as DirectionLinks from "./DirectionLinks.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -29,9 +29,6 @@ Use direction links to indicate a physical direction, such as:
|
|
|
29
29
|
- <a className="figma-link" href={figmaLinks.directionLinks.design} target="_blank" rel="noopener noreferrer">
|
|
30
30
|
Component design view (Figma)
|
|
31
31
|
</a>
|
|
32
|
-
- <a className="figma-link" href={figmaLinks.directionLinks.file} target="_blank" rel="noopener noreferrer">
|
|
33
|
-
Component file (Figma)
|
|
34
|
-
</a>
|
|
35
32
|
- <a className="figma-link" href={figmaLinks.directionLinks.ds} target="_blank" rel="noopener noreferrer">
|
|
36
33
|
Design System website
|
|
37
34
|
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Primary, Controls, Story, Source
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as InPageAlertsStories from "./InPageAlert.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -59,9 +59,6 @@ In-page alerts do not have theme variants.
|
|
|
59
59
|
- <a className="figma-link" href={figmaLinks.inPageAlert.design} target="_blank" rel="noopener noreferrer">
|
|
60
60
|
Component design view (Figma)
|
|
61
61
|
</a>
|
|
62
|
-
- <a className="figma-link" href={figmaLinks.inPageAlert.file} target="_blank" rel="noopener noreferrer">
|
|
63
|
-
Component file (Figma)
|
|
64
|
-
</a>
|
|
65
62
|
- <a className="figma-link" href={figmaLinks.inPageAlert.ds} target="_blank" rel="noopener noreferrer">
|
|
66
63
|
Design System website
|
|
67
64
|
</a>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
|
1
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
2
2
|
|
|
3
3
|
<Meta title="Introduction" />
|
|
4
4
|
|
|
5
|
-
# Queensland Government Design System -
|
|
5
|
+
# Queensland Government Design System - VanillaJS - Edition
|
|
6
6
|
|
|
7
7
|
The Queensland Government design system helps teams create consistent, user-centric digital experiences quickly.
|
|
8
8
|
|
|
@@ -24,12 +24,16 @@ Prior to using QGDS, please liaise with Queensland Online to ensure that the pla
|
|
|
24
24
|
|
|
25
25
|
If you have already been through the recommendation process with Queensland Online and your site has been endorsed as an approved campaign or corporate site, and is outside the franchise or Forgov model, please contact us to discuss how your team could become a community consumer of the current version of QGDS.
|
|
26
26
|
|
|
27
|
+
## Cloning the repository
|
|
28
|
+
|
|
29
|
+
Use `git clone https://github.com/Qld-Health-Online-Team/design-system.git` to clone the repository locally.
|
|
30
|
+
|
|
27
31
|
## Running and building storybook
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
Once you have cloned the repository, follow the below steps:
|
|
30
34
|
|
|
31
|
-
1. Execute `npm install` in
|
|
35
|
+
1. Execute `npm install` in the directory to download the required dependencies
|
|
32
36
|
|
|
33
|
-
2. Execute `npm run build-storybook` to generate and build necessary
|
|
37
|
+
2. Execute `npm run build-storybook` to generate and build necessary files
|
|
34
38
|
|
|
35
39
|
3. Execute `npm run storybook` to locally host the application
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Primary, Controls, Story, Source } from "@storybook/blocks";
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import * as LinkColumns from "./LinkColumns.stories";
|
|
3
3
|
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
4
|
|
|
@@ -23,9 +23,6 @@ The link columns component consists of a single continuous list of links that ca
|
|
|
23
23
|
- <a className="figma-link" href={figmaLinks.linkColumns.design} target="_blank" rel="noopener noreferrer">
|
|
24
24
|
Component design view (Figma)
|
|
25
25
|
</a>
|
|
26
|
-
- <a className="figma-link" href={figmaLinks.linkColumns.file} target="_blank" rel="noopener noreferrer">
|
|
27
|
-
Component file (Figma)
|
|
28
|
-
</a>
|
|
29
26
|
- <a className="figma-link" href={figmaLinks.linkColumns.ds} target="_blank" rel="noopener noreferrer">
|
|
30
27
|
Design System website
|
|
31
28
|
</a>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import * as PaginationStories from "./Pagination.stories";
|
|
3
|
+
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
|
+
|
|
5
|
+
<Meta of={PaginationStories} />
|
|
6
|
+
|
|
7
|
+
# Pagination
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Pagination is used to divide large amounts of content into a series of pages. This allows users to navigate through the content more easily, with controls for moving to the next or previous page, and an option to jump to a specific page. Whether it's search results or product catalogues, pagination helps users browse through the content in a more organised and manageable way.
|
|
12
|
+
|
|
13
|
+
<Primary />
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
<Controls />
|
|
18
|
+
|
|
19
|
+
## Design resources
|
|
20
|
+
|
|
21
|
+
- <a className="figma-link" href={figmaLinks.pagination.design} target="_blank" rel="noopener noreferrer">
|
|
22
|
+
Component design view (Figma)
|
|
23
|
+
</a>
|
|
24
|
+
- <a className="figma-link" href={figmaLinks.pagination.ds} target="_blank" rel="noopener noreferrer">
|
|
25
|
+
Design System website
|
|
26
|
+
</a>
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import Handlebars from "handlebars";
|
|
2
|
+
import Template from "../../components/pagination/html/component.hbs?raw";
|
|
3
|
+
import { figmaLinks, themes } from "../../../.storybook/globals";
|
|
4
|
+
|
|
5
|
+
const renderPagination = ({ data, ...args }) =>
|
|
6
|
+
Handlebars.compile(Template)({
|
|
7
|
+
pagination: data,
|
|
8
|
+
...args,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const paginationData = [
|
|
12
|
+
{
|
|
13
|
+
linkType: "prev",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 1,
|
|
17
|
+
isCurrent: false,
|
|
18
|
+
linkType: "num",
|
|
19
|
+
url: "https://www.google.com/",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 2,
|
|
23
|
+
isCurrent: false,
|
|
24
|
+
linkType: "num",
|
|
25
|
+
url: "https://www.google.com/",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 3,
|
|
29
|
+
isCurrent: true,
|
|
30
|
+
linkType: "num",
|
|
31
|
+
url: "https://www.google.com/",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 4,
|
|
35
|
+
isCurrent: false,
|
|
36
|
+
linkType: "num",
|
|
37
|
+
url: "https://www.google.com/",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 5,
|
|
41
|
+
isCurrent: false,
|
|
42
|
+
linkType: "num",
|
|
43
|
+
url: "https://www.google.com/",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 8,
|
|
47
|
+
linkType: "last",
|
|
48
|
+
url: "https://www.google.com/",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
linkType: "next",
|
|
52
|
+
url: "https://www.google.com/",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const paginationDataShort = [
|
|
57
|
+
{
|
|
58
|
+
linkType: "prev",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 1,
|
|
62
|
+
isCurrent: false,
|
|
63
|
+
linkType: "num",
|
|
64
|
+
url: "https://www.google.com/",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 2,
|
|
68
|
+
isCurrent: true,
|
|
69
|
+
linkType: "num",
|
|
70
|
+
url: "https://www.google.com/",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: 3,
|
|
74
|
+
isCurrent: false,
|
|
75
|
+
linkType: "num",
|
|
76
|
+
url: "https://www.google.com/",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
linkType: "next",
|
|
80
|
+
url: "https://www.google.com/",
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const paginationDataLong = [
|
|
85
|
+
{
|
|
86
|
+
linkType: "prev",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: 1,
|
|
90
|
+
isCurrent: false,
|
|
91
|
+
linkType: "first",
|
|
92
|
+
url: "https://www.google.com/",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: 6,
|
|
96
|
+
isCurrent: false,
|
|
97
|
+
linkType: "num",
|
|
98
|
+
url: "https://www.google.com/",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: 7,
|
|
102
|
+
isCurrent: true,
|
|
103
|
+
linkType: "num",
|
|
104
|
+
url: "https://www.google.com/",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
label: 8,
|
|
108
|
+
isCurrent: false,
|
|
109
|
+
linkType: "num",
|
|
110
|
+
url: "https://www.google.com/",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: 15,
|
|
114
|
+
isCurrent: false,
|
|
115
|
+
linkType: "last",
|
|
116
|
+
url: "https://www.google.com/",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
linkType: "next",
|
|
120
|
+
url: "https://www.google.com/",
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const paginationDataPreviousOnly = [
|
|
125
|
+
{
|
|
126
|
+
linkType: "prev",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: 1,
|
|
130
|
+
isCurrent: false,
|
|
131
|
+
linkType: "num",
|
|
132
|
+
url: "https://www.google.com/",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: 2,
|
|
136
|
+
isCurrent: false,
|
|
137
|
+
linkType: "num",
|
|
138
|
+
url: "https://www.google.com/",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: 3,
|
|
142
|
+
isCurrent: true,
|
|
143
|
+
linkType: "num",
|
|
144
|
+
url: "https://www.google.com/",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: 4,
|
|
148
|
+
isCurrent: false,
|
|
149
|
+
linkType: "num",
|
|
150
|
+
url: "https://www.google.com/",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: 5,
|
|
154
|
+
isCurrent: false,
|
|
155
|
+
linkType: "num",
|
|
156
|
+
url: "https://www.google.com/",
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
const paginationDataNextOnly = [
|
|
161
|
+
{
|
|
162
|
+
label: 1,
|
|
163
|
+
isCurrent: false,
|
|
164
|
+
linkType: "num",
|
|
165
|
+
url: "https://www.google.com/",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: 2,
|
|
169
|
+
isCurrent: false,
|
|
170
|
+
linkType: "num",
|
|
171
|
+
url: "https://www.google.com/",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 3,
|
|
175
|
+
isCurrent: true,
|
|
176
|
+
linkType: "num",
|
|
177
|
+
url: "https://www.google.com/",
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: 4,
|
|
181
|
+
isCurrent: false,
|
|
182
|
+
linkType: "num",
|
|
183
|
+
url: "https://www.google.com/",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
label: 5,
|
|
187
|
+
isCurrent: false,
|
|
188
|
+
linkType: "num",
|
|
189
|
+
url: "https://www.google.com/",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
linkType: "next",
|
|
193
|
+
url: "https://www.google.com/",
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
export default {
|
|
198
|
+
title: "Components/Pagination",
|
|
199
|
+
render: renderPagination,
|
|
200
|
+
args: { data: paginationData },
|
|
201
|
+
parameters: {
|
|
202
|
+
design: {
|
|
203
|
+
type: "figma",
|
|
204
|
+
url: figmaLinks.pagination.design,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const Default = {};
|
|
210
|
+
|
|
211
|
+
export const light = {
|
|
212
|
+
render: (args) => {
|
|
213
|
+
return `<div class="${themes["light"]}">
|
|
214
|
+
${renderPagination(args)}
|
|
215
|
+
</div>`;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const lightAlt = {
|
|
220
|
+
render: (args) => {
|
|
221
|
+
return `<div class="${themes["light alt"]}">
|
|
222
|
+
${renderPagination(args)}
|
|
223
|
+
</div>`;
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const dark = {
|
|
228
|
+
render: (args) => {
|
|
229
|
+
return `<div class="${themes["dark"]}">
|
|
230
|
+
${renderPagination(args)}
|
|
231
|
+
</div>`;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const darkAlt = {
|
|
236
|
+
render: (args) => {
|
|
237
|
+
return `<div class="${themes["dark alt"]}">
|
|
238
|
+
${renderPagination(args)}
|
|
239
|
+
</div>`;
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export const short = {
|
|
244
|
+
args: { data: paginationDataShort },
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export const long = {
|
|
248
|
+
args: { data: paginationDataLong },
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const previousOnly = {
|
|
252
|
+
args: { data: paginationDataPreviousOnly },
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const nextOnly = {
|
|
256
|
+
args: { data: paginationDataNextOnly },
|
|
257
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Meta, Primary, Controls, Story, Source } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import * as PromoPanelStories from "./PromoPanel.stories";
|
|
3
|
+
import { figmaLinks } from "../../../.storybook/globals";
|
|
4
|
+
|
|
5
|
+
<Meta of={PromoPanelStories} />
|
|
6
|
+
|
|
7
|
+
# Promo Panel
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Promotional panels are a key element in web design used to highlight specific content or messages. They act as a visual break on a page, drawing attention to important announcements, new features, or promotional content. These panels typically consist of a combination of text and images designed to engage users and guide them toward a desired action, such as clicking a link or learning more about a particular topic.
|
|
12
|
+
|
|
13
|
+
<Primary />
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
<Controls />
|
|
18
|
+
|
|
19
|
+
## Design resources
|
|
20
|
+
|
|
21
|
+
- <a className="figma-link" href={figmaLinks.promoPanel.design} target="_blank" rel="noopener noreferrer">
|
|
22
|
+
Component design view (Figma)
|
|
23
|
+
</a>
|
|
24
|
+
- <a className="figma-link" href={figmaLinks.promoPanel.ds} target="_blank" rel="noopener noreferrer">
|
|
25
|
+
Design System website
|
|
26
|
+
</a>
|