@qld-gov-au/qgds-bootstrap5 2.0.1 → 2.0.2
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/dist/assets/components/bs5/accordion/accordion.hbs +3 -3
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/components/bs5/quickexit/quickexit.hbs +1 -1
- package/dist/assets/css/qld.bootstrap.css +1 -1
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/js/handlebars.init.min.js +5 -5
- package/dist/assets/js/handlebars.init.min.js.map +1 -1
- package/dist/assets/node/handlebars.init.min.js +31 -3
- package/dist/assets/node/handlebars.init.min.js.map +2 -2
- package/dist/components/bs5/accordion/accordion.hbs +3 -3
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/components/bs5/quickexit/quickexit.hbs +1 -1
- package/dist/package.json +1 -1
- package/dist/sample-data/accordion/accordion.data.json +24 -23
- package/package.json +1 -1
- package/src/components/bs5/accordion/Accordion.mdx +1 -3
- package/src/components/bs5/accordion/__snapshots__/accordion.test.js.snap +3 -3
- package/src/components/bs5/accordion/accordion.data.json +24 -23
- package/src/components/bs5/accordion/accordion.hbs +3 -3
- package/src/components/bs5/accordion/accordion.scss +19 -9
- package/src/components/bs5/accordion/accordion.stories.js +8 -0
- package/src/components/bs5/accordion/accordion.test.js +5 -0
- package/src/components/bs5/backToTop/backToTop.mdx +4 -5
- package/src/components/bs5/banner/Banner.mdx +1 -3
- package/src/components/bs5/blockquote/Blockquote.mdx +4 -5
- package/src/components/bs5/breadcrumbs/Breadcrumbs.mdx +1 -3
- package/src/components/bs5/button/Button.mdx +4 -5
- package/src/components/bs5/button/button.scss +9 -1
- package/src/components/bs5/callToAction/callToAction.mdx +1 -3
- package/src/components/bs5/callout/Callout.mdx +4 -5
- package/src/components/bs5/card/Card.mdx +1 -3
- package/src/components/bs5/card/card.scss +1 -25
- package/src/components/bs5/directionLinks/DirectionLinks.mdx +4 -5
- package/src/components/bs5/footer/Footer.mdx +1 -3
- package/src/components/bs5/footer/footer.scss +4 -11
- package/src/components/bs5/formcheck/stories/checkbox/Checkbox.mdx +7 -6
- package/src/components/bs5/formcheck/stories/radio/Radio.mdx +7 -6
- package/src/components/bs5/globalAlert/GlobalAlert.mdx +1 -3
- package/src/components/bs5/globalAlert/globalAlert.scss +6 -0
- package/src/components/bs5/header/Header.mdx +1 -3
- package/src/components/bs5/header/header.scss +6 -2
- package/src/components/bs5/icons/Icons.mdx +167 -7
- package/src/components/bs5/icons/_icons.sizes.scss +9 -0
- package/src/components/bs5/icons/icons.scss +23 -71
- package/src/components/bs5/icons/icons.stories.js +34 -57
- package/src/components/bs5/icons/mdx/_IconsSizes.mdx +112 -0
- package/src/components/bs5/icons/stories/storyFlexContainer.html +18 -0
- package/src/components/bs5/icons/stories/storyInlineWithText.html +18 -0
- package/src/components/bs5/icons/stories/storySizes.html +89 -0
- package/src/components/bs5/image/Image.mdx +1 -4
- package/src/components/bs5/inpageAlert/InpageAlert.mdx +1 -3
- package/src/components/bs5/inpagenav/Inpagenav.mdx +4 -5
- package/src/components/bs5/link/link.mdx +1 -3
- package/src/components/bs5/link/link.scss +2 -15
- package/src/components/bs5/linkColumns/linkColumns.mdx +1 -3
- package/src/components/bs5/logo/Logo.mdx +1 -3
- package/src/components/bs5/pageLayout/ThemeShowcase.stories.js +249 -0
- package/src/components/bs5/pagination/Pagination.mdx +4 -5
- package/src/components/bs5/promotionalPanel/PromotionalPanel.mdx +1 -3
- package/src/components/bs5/quickexit/quickexit.hbs +1 -1
- package/src/components/bs5/quickexit/quickexit.scss +23 -10
- package/src/components/bs5/searchInput/SearchInput.mdx +5 -5
- package/src/components/bs5/sidenav/Sidenav.mdx +4 -5
- package/src/components/bs5/skiplinks/SkipLinks.mdx +1 -3
- package/src/components/bs5/table/Table.mdx +4 -5
- package/src/components/bs5/tabs/Tabs.mdx +4 -5
- package/src/components/bs5/tabs/tabs.scss +22 -1
- package/src/components/bs5/tag/Tag.mdx +4 -5
- package/src/components/bs5/typography/Typography.mdx +4 -5
- package/src/components/bs5/video/Video.mdx +4 -5
- package/src/css/functions/_index.scss +1 -0
- package/src/css/functions/in-list.scss +5 -0
- package/src/css/main.scss +4 -3
- package/src/css/mixins/_index.scss +3 -0
- package/src/css/mixins/make-icon.scss +87 -0
- package/src/css/qld-theme.scss +73 -31
- package/src/css/qld-type.scss +26 -140
- package/src/css/qld-utilities.scss +29 -14
- package/src/css/qld-variables.scss +4 -4
- package/src/css/variables/_index.scss +1 -0
- package/src/css/variables/type.scss +58 -0
- package/src/components/bs5/icons/story-icon-sizing.html +0 -131
- package/src/components/bs5/icons/story-icon-usage.html +0 -89
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from "@storybook/blocks"
|
|
2
|
-
import * as FormCheckRadioStories from "./radio.stories"
|
|
1
|
+
import { Canvas, Meta, Story } from "@storybook/blocks";
|
|
2
|
+
import * as FormCheckRadioStories from "./radio.stories";
|
|
3
3
|
|
|
4
4
|
<Meta of={FormCheckRadioStories} />
|
|
5
5
|
|
|
6
6
|
# Form check (Radio)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</Canvas>
|
|
7
|
+
|
|
8
|
+
<Canvas of={FormCheckRadioStories.Default} />
|
|
10
9
|
|
|
11
10
|
## Design resources
|
|
11
|
+
|
|
12
12
|
- [Bootstrap component](https://getbootstrap.com/docs/5.3/forms/checks-radios/)
|
|
13
13
|
|
|
14
14
|
### Radio
|
|
15
|
+
|
|
15
16
|
- [Component library (Figma)](https://www.figma.com/file/qKsxl3ogIlBp7dafgxXuCA/QLD-GOV-DDS?type=design&node-id=6274-42582&mode=design&t=sWeMBpAnKzpGzmWI-4)
|
|
16
17
|
- [Master component file (Figma)](https://www.figma.com/file/qKsxl3ogIlBp7dafgxXuCA/QLD-GOV-DDS?type=design&node-id=11056-321347&mode=design&t=9b0T06NG5P47amzB-0)
|
|
17
|
-
- [Design System website](https://www.design-system.health.qld.gov.au/components/radio-buttons)
|
|
18
|
+
- [Design System website](https://www.design-system.health.qld.gov.au/components/radio-buttons)
|
|
@@ -118,6 +118,8 @@
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
&.global-alert-critical {
|
|
121
|
+
--#{$prefix}icon-color: #{$core-default-color-neutral-white};
|
|
122
|
+
//
|
|
121
123
|
background-color: $qld-notify-warning;
|
|
122
124
|
color: var(--#{$prefix}white);
|
|
123
125
|
font-size: 0.875em;
|
|
@@ -153,6 +155,8 @@
|
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
&.global-alert-warning {
|
|
158
|
+
--#{$prefix}icon-color: #{$core-default-color-neutral-black};
|
|
159
|
+
//
|
|
156
160
|
background-color: $qld-notify-alert;
|
|
157
161
|
color: var(--#{$prefix}body-color);
|
|
158
162
|
font-size: 0.875em;
|
|
@@ -165,6 +169,8 @@
|
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
&.global-alert-info {
|
|
172
|
+
--#{$prefix}icon-color: #{$core-default-color-neutral-black};
|
|
173
|
+
//
|
|
168
174
|
background-color: $qld-general-info-alert;
|
|
169
175
|
color: var(--#{$prefix}body-color);
|
|
170
176
|
font-size: 0.875em;
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
.qld-header {
|
|
19
19
|
@extend %header-variables;
|
|
20
|
-
|
|
21
|
-
background: var(--#{$prefix}header-color-bg);
|
|
20
|
+
|
|
22
21
|
font-size: 1rem;
|
|
23
22
|
|
|
24
23
|
@include media-breakpoint-up(sm) {
|
|
@@ -262,6 +261,7 @@
|
|
|
262
261
|
border-bottom: solid 1px var(--#{$prefix}header__CTA_border_color);
|
|
263
262
|
padding: 1rem 1.75rem 1rem 0;
|
|
264
263
|
line-height: 1.5;
|
|
264
|
+
white-space: normal; // allow text to wrap
|
|
265
265
|
|
|
266
266
|
&:visited {
|
|
267
267
|
color: var(--#{$prefix}header__CTA_text_color);
|
|
@@ -285,10 +285,14 @@
|
|
|
285
285
|
color: var(--#{$prefix}header__cta-wrapper__cta-link-icon_color);
|
|
286
286
|
position: absolute;
|
|
287
287
|
right: 0;
|
|
288
|
+
top: 50%;
|
|
289
|
+
transform: translateY(-50%);
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
&-main {
|
|
291
293
|
position: relative;
|
|
294
|
+
color: var(--#{$prefix}header-color-text);
|
|
295
|
+
background: var(--#{$prefix}header-color-bg);
|
|
292
296
|
}
|
|
293
297
|
|
|
294
298
|
&-brand {
|
|
@@ -1,13 +1,173 @@
|
|
|
1
|
-
import { Canvas, Meta, Story,
|
|
2
|
-
import * as
|
|
1
|
+
import { Canvas, Meta, Story, Markdown } from "@storybook/blocks";
|
|
2
|
+
import * as IconStories from "./icons.stories.js";
|
|
3
|
+
import IconsSizes from "./mdx/_IconsSizes.mdx";
|
|
3
4
|
|
|
4
|
-
<Meta of={
|
|
5
|
+
<Meta of={IconStories} />
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
<Canvas>
|
|
8
|
-
<Story of={IconsStories.Overview} />
|
|
9
|
-
</Canvas>
|
|
7
|
+
# Iconography
|
|
10
8
|
|
|
9
|
+
The icons in QGDS can be used in multiple ways depending on your needs and environment. This guide covers the 4 primary methods as well as the sizing utilities:
|
|
10
|
+
|
|
11
|
+
- **Inline SVG**
|
|
12
|
+
- **CSS utility class**
|
|
13
|
+
- **SCSS mixin**
|
|
14
|
+
- **CSS variables**
|
|
15
|
+
|
|
16
|
+
## Inline SVG (HTML Embed)
|
|
17
|
+
|
|
18
|
+
This method allows for full control over the icon's appearance, eg: colour,
|
|
19
|
+
size, stroke, etc. Recommended for developers and content editors embedding
|
|
20
|
+
icons directly in HTML.
|
|
21
|
+
|
|
22
|
+
Place the Symbol ID on to the `<use>` element within an `<svg>` tag. Example:
|
|
23
|
+
|
|
24
|
+
<svg
|
|
25
|
+
className="qld-icon qld-icon-lg"
|
|
26
|
+
style={{ color: "#dd0000" }}
|
|
27
|
+
aria-label="Cancel alert"
|
|
28
|
+
role="img"
|
|
29
|
+
>
|
|
30
|
+
<use href="./assets/img/icons-sprite.svg#qgds-icon-alert-cancel"></use>
|
|
31
|
+
</svg>
|
|
32
|
+
<svg
|
|
33
|
+
className="qld-icon qld-icon-lg"
|
|
34
|
+
style={{ color: "#ffa500" }}
|
|
35
|
+
aria-label="Warning alert"
|
|
36
|
+
role="img"
|
|
37
|
+
>
|
|
38
|
+
<use href="./assets/img/icons-sprite.svg#qgds-icon-alert-warning"></use>
|
|
39
|
+
</svg>
|
|
40
|
+
<svg
|
|
41
|
+
className="qld-icon qld-icon-lg"
|
|
42
|
+
style={{ color: "#00dd00" }}
|
|
43
|
+
aria-label="Success alert"
|
|
44
|
+
role="img"
|
|
45
|
+
>
|
|
46
|
+
<use href="./assets/img/icons-sprite.svg#qgds-icon-alert-success"></use>
|
|
47
|
+
</svg>
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<svg className="qld-icon qld-icon-lg" aria-label="Cancel alert">
|
|
51
|
+
<use href="./assets/img/icons-sprite.svg#qgds-icon-alert-cancel"></use>
|
|
52
|
+
</svg>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Accessibility
|
|
56
|
+
|
|
57
|
+
- Always include `role="img"` and `aria-label`
|
|
58
|
+
attributes to provide context for screen readers.
|
|
59
|
+
|
|
60
|
+
- Use `aria-hidden="true"` when the icon is decorative
|
|
61
|
+
|
|
62
|
+
## CSS Class
|
|
63
|
+
|
|
64
|
+
This method is suitable for developers who want to apply icons in their stylesheets.
|
|
65
|
+
|
|
66
|
+
Use the `qld-icon` + `qld-icon-{iconName}` utility class to render icons as CSS masked elements.
|
|
67
|
+
Example:
|
|
68
|
+
|
|
69
|
+
<div>
|
|
70
|
+
<span class="qld-icon qld-icon-lg qld-icon-home" aria-hidden="true"></span>
|
|
71
|
+
<span class="qld-icon qld-icon-lg qld-icon-search" aria-hidden="true"></span>
|
|
72
|
+
<span class="qld-icon qld-icon-lg qld-icon-menu" aria-hidden="true"></span>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
{/* prettier-ignore-start */}
|
|
76
|
+
```html
|
|
77
|
+
<span class="qld-icon qld-icon-lg qld-icon-home" aria-hidden="true"></span>
|
|
78
|
+
<span class="qld-icon qld-icon-lg qld-icon-search" aria-hidden="true"></span>
|
|
79
|
+
<span class="qld-icon qld-icon-lg qld-icon-menu" aria-hidden="true"></span>
|
|
80
|
+
```
|
|
81
|
+
{/* prettier-ignore-end */}
|
|
82
|
+
|
|
83
|
+
### Accessibility
|
|
84
|
+
|
|
85
|
+
- This method is for decorative only. Use `aria-hidden="true"` to hide the icon from screen readers.
|
|
86
|
+
- Ensure to use it alongside text or other elements that provide context for screen readers users.
|
|
87
|
+
|
|
88
|
+
## SCSS mixin
|
|
89
|
+
|
|
90
|
+
For developers with access to scss source code, and when it is not feasible to alter existing html markup, you can apply the `make-icon` mixin to any existing class.
|
|
91
|
+
Using the mixin ensures consistent implementation and API with standard icon classes.
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
/* @use - sass module system. Make sure the path is correct for your particular implementation. */
|
|
95
|
+
@use "/../../css/mixins";
|
|
96
|
+
|
|
97
|
+
.my-custom-class {
|
|
98
|
+
@include mixins.make-icon($name: "alert-cancel");
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Mixin API
|
|
103
|
+
|
|
104
|
+
<Markdown>
|
|
105
|
+
{`
|
|
106
|
+
| Parameter | Type | Description |
|
|
107
|
+
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| \`$name\` | String | The name of icon. eg "alert-cancel". Optional but recoommended. |
|
|
109
|
+
| \`$size\` | String | The icon size, valid values are \`"xs"\`, \`"sm"\`(default), \`"md"\`, \`"lg"\`, \`"xl"\`, \`"xxl"\`. |
|
|
110
|
+
| \`$pseudo\` | String | Optionally apply styles as a pseudo-element. Valid string values are \`"before"\`, \`"after"\`, \`null\`(default) |
|
|
111
|
+
| \`$is-inline\` | Boolean | Applies extra styles to assist with vertical alignent when used inline with text. Default:\`false\` |
|
|
112
|
+
| \`$include-base\` | Boolean | Apply all base styles. Set to false when creating modifier classes where base styles are already applied. Default:\`true\`|
|
|
113
|
+
`}
|
|
114
|
+
|
|
115
|
+
</Markdown>
|
|
116
|
+
|
|
117
|
+
## CSS Variables
|
|
118
|
+
|
|
119
|
+
As a last resort this method allows developers to create custom styles with any CSS property that accepts a URL, such as <code>mask-image</code> and <code>background-image</code>.
|
|
120
|
+
Only use this method in custom CSS where you don't have access to precompiled scss.
|
|
121
|
+
Example:
|
|
122
|
+
|
|
123
|
+
```css
|
|
124
|
+
.mysite-icon-cancel-payment {
|
|
125
|
+
mask-image: var(--qgds-icon-alert-cancel);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.abc-icon-login {
|
|
129
|
+
background-image: var(--qgds-icon-identity);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Accessibility
|
|
134
|
+
|
|
135
|
+
- This method is for decorative only. Use `aria-hidden="true"` to hide the icon from screen readers.
|
|
136
|
+
- Ensure to use it alongside text or other elements that provide context for screen readers users.
|
|
137
|
+
|
|
138
|
+
<IconsSizes />
|
|
139
|
+
|
|
140
|
+
## Working with color
|
|
141
|
+
|
|
142
|
+
Assigning a value to the custom property `--qld-icon-color` to alter an icon's color.
|
|
143
|
+
This ensures the same API between inline SVGs, CSS classes and SCSS mixin. An extra benefit is that custom property cascades, meaning icons will inherit whatever value is set on its ancestors.
|
|
144
|
+
|
|
145
|
+
<span className="my-link-with-icon" style={{ "--qld-icon-color": "red" }}>
|
|
146
|
+
<span class="qld-icon qld-icon-alert-danger"></span> Custom properties rock!
|
|
147
|
+
</span>
|
|
148
|
+
|
|
149
|
+
{/* prettier-ignore-start */}
|
|
150
|
+
```html
|
|
151
|
+
<span class="my-link-with-icon" style="--qld-icon-color: red">
|
|
152
|
+
<span class="qld-icon qld-icon-alert-danger"></span>
|
|
153
|
+
Custom properties rock!
|
|
154
|
+
</span>
|
|
155
|
+
```
|
|
156
|
+
{/* prettier-ignore-end */}
|
|
157
|
+
|
|
158
|
+
## Vertical Alignment
|
|
159
|
+
|
|
160
|
+
### Inline with text
|
|
161
|
+
|
|
162
|
+
When using icons inline with text, add additional class `is-inline` to the icon to assist with vertical alignment.
|
|
163
|
+
|
|
164
|
+
<Canvas of={IconStories.InlineWithText} />
|
|
165
|
+
|
|
166
|
+
### Within a flex container
|
|
167
|
+
|
|
168
|
+
Use flex utility classes when within a flex container, either `align-items-center` on the parent, or `align-self-center` on the icon itself.
|
|
169
|
+
|
|
170
|
+
<Canvas of={IconStories.FlexContainer} />
|
|
11
171
|
|
|
12
172
|
## Design resources
|
|
13
173
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
@forward "./_icons.variables";
|
|
2
|
+
@use "./_icons.list" as *;
|
|
3
|
+
@use "./icons.sizes" as *;
|
|
4
|
+
@use "../../../css/mixins" as m;
|
|
5
|
+
|
|
1
6
|
/* @TODO: Remove lines in between once all the icons within the components have been synced with new icons. */
|
|
2
7
|
:root {
|
|
3
8
|
//Define global icons as CSS variables
|
|
@@ -9,23 +14,6 @@
|
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
.qld-icon {
|
|
12
|
-
//Shared icon styles
|
|
13
|
-
display: inline-block;
|
|
14
|
-
width: 1.25rem;
|
|
15
|
-
height: 1.25rem;
|
|
16
|
-
background-position: center center;
|
|
17
|
-
background-repeat: no-repeat;
|
|
18
|
-
mask-position: center center;
|
|
19
|
-
-webkit-mask-position: center center;
|
|
20
|
-
mask-repeat: no-repeat;
|
|
21
|
-
-webkit-mask-repeat: no-repeat;
|
|
22
|
-
|
|
23
|
-
//Default color
|
|
24
|
-
background: var(--#{$prefix}icon-color);
|
|
25
|
-
|
|
26
|
-
//Change color at component level... e.g. on cards.css, use:
|
|
27
|
-
// .card { --#{$prefix}icon-color: purple; }
|
|
28
|
-
|
|
29
17
|
&.icon-dot-grid {
|
|
30
18
|
mask-image: escape-svg(var(--icon-dot-grid));
|
|
31
19
|
-webkit-mask-image: escape-svg(var(--icon-dot-grid));
|
|
@@ -50,69 +38,33 @@
|
|
|
50
38
|
}
|
|
51
39
|
/* @TODO: Remove all lines above once all the icons within the components have been synced with new icons. */
|
|
52
40
|
|
|
53
|
-
@import "./_icons.variables";
|
|
54
|
-
@import "./_icons.list";
|
|
55
|
-
@import "./_icons-multicolours.list";
|
|
56
|
-
|
|
57
|
-
$prefixIcon: $prefix + "icon-"; // Prefix for icon classes, based on global prefix in main.scss
|
|
58
|
-
$prefixIconQgds: "--qgds-icon-"; // This QGDS variable could be moved to the token or tolkien repo.
|
|
59
|
-
|
|
60
|
-
// Ensure SVGs inherit the current text color
|
|
61
|
-
// Comment out to use the "fill" attribute inside svg element instead
|
|
62
|
-
/*
|
|
63
|
-
svg {
|
|
64
|
-
fill: currentColor;
|
|
65
|
-
} */
|
|
66
|
-
|
|
67
|
-
// List of icon sizes
|
|
68
|
-
$icon-sizes: (
|
|
69
|
-
"xs": 1rem,
|
|
70
|
-
"sm": 1.25rem,
|
|
71
|
-
"md": 1.5rem,
|
|
72
|
-
"lg": 2rem,
|
|
73
|
-
"xl": 2.5rem,
|
|
74
|
-
"xxl": 3rem,
|
|
75
|
-
);
|
|
76
|
-
|
|
77
41
|
// Loop through the icon names and create utility class for each
|
|
78
42
|
.qld-icon {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
mask-position: center center;
|
|
85
|
-
mask-repeat: no-repeat;
|
|
86
|
-
mask-size: contain;
|
|
87
|
-
background-color: var(--#{$prefix}body-color); // Default icon color
|
|
43
|
+
@include m.make-icon();
|
|
44
|
+
|
|
45
|
+
&:where(svg) {
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
}
|
|
88
48
|
|
|
89
49
|
// Utility classes for icons
|
|
90
50
|
// Note: mask-image is the preferred method for icons that are single colour, as it allows for easy colour changes using CSS variables.
|
|
91
51
|
// The background-image method is used for SVG icons with multiple fill colours.
|
|
92
52
|
@each $icon in $icon-names {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-webkit-mask-image: var(#{$prefixIconQgds}#{$icon});
|
|
104
|
-
}
|
|
53
|
+
&-#{$icon} {
|
|
54
|
+
@include m.make-icon($name: $icon, $include-base: false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Loop through the icon sizes and create utility class for each size.
|
|
59
|
+
// Independent from the icon base class to allow sizing on inline SVG icons as well as CSS icons.
|
|
60
|
+
@each $key, $value in $icon-sizes {
|
|
61
|
+
&-#{$key} {
|
|
62
|
+
--icon-size: #{$value};
|
|
105
63
|
}
|
|
106
64
|
}
|
|
107
|
-
}
|
|
108
65
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
@
|
|
112
|
-
.#{$prefixIcon}#{$size} {
|
|
113
|
-
width: $value;
|
|
114
|
-
height: $value;
|
|
115
|
-
mask-size: $value;
|
|
116
|
-
background-size: $value;
|
|
66
|
+
// Better alignment for icons inline with text
|
|
67
|
+
&.is-inline {
|
|
68
|
+
@include m.make-icon($include-base: false, $is-inline: true);
|
|
117
69
|
}
|
|
118
70
|
}
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import iconNames from "./_icons.list.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import storyInlineWithTextHtml from "./stories/storyInlineWithText.html?raw";
|
|
3
|
+
import storyFlexContainerHtml from "./stories/storyFlexContainer.html?raw";
|
|
4
|
+
import storySizesHtml from "./stories/storySizes.html?raw";
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
"description": "Card body text",
|
|
9
|
-
"date": "",
|
|
10
|
-
"variantClass": "default",
|
|
11
|
-
"image": "",
|
|
12
|
-
"imageAlt": "",
|
|
13
|
-
"iconClasses": "",
|
|
14
|
-
"iconPosition": "icon-top",
|
|
15
|
-
"action": "no",
|
|
16
|
-
"link": "",
|
|
17
|
-
"arrow": false,
|
|
18
|
-
"feature": false,
|
|
19
|
-
"featureImagePosition": "",
|
|
20
|
-
"video": false,
|
|
21
|
-
"videoDuration": "",
|
|
22
|
-
"footer": "",
|
|
23
|
-
"equalHeight": false,
|
|
24
|
-
};
|
|
25
|
-
const SPRITE_PATH = './assets/img/icons-sprite.svg';
|
|
26
|
-
const PREFIX_QGDS = 'qgds-icon-';
|
|
6
|
+
const SPRITE_PATH = "./assets/img/icons-sprite.svg";
|
|
7
|
+
const PREFIX_QGDS = "qgds-icon-";
|
|
27
8
|
|
|
28
9
|
// Helper function to remove the prefix from icon names
|
|
29
10
|
function _removePrefixQGDS(name) {
|
|
@@ -33,48 +14,42 @@ function _removePrefixQGDS(name) {
|
|
|
33
14
|
return name;
|
|
34
15
|
}
|
|
35
16
|
|
|
36
|
-
|
|
37
17
|
// Default export for Storybook
|
|
38
18
|
export default {
|
|
39
19
|
tags: ["autodocs"],
|
|
40
20
|
title: "1. Core Styles/Iconography",
|
|
41
|
-
render: () => {
|
|
42
|
-
return iconUsageHtml + `<hr>` + iconSizingHtml;
|
|
43
|
-
},
|
|
44
21
|
parameters: {
|
|
45
22
|
layout: "padded",
|
|
46
23
|
docs: {
|
|
47
24
|
title: "Iconography in default",
|
|
48
|
-
|
|
25
|
+
// page: null, // To disable autodocs
|
|
49
26
|
},
|
|
50
27
|
},
|
|
51
28
|
};
|
|
52
29
|
|
|
53
|
-
// Exports default as Overview, in order to avoid another "Default" menu in Storybook
|
|
54
|
-
export const Overview = {};
|
|
55
|
-
|
|
56
30
|
// Story for displaying all icons as SVGs
|
|
57
31
|
export const SvgIcons = () => {
|
|
58
32
|
return `
|
|
59
33
|
<div class="container">
|
|
60
34
|
<div class="row row-cols-sm-2 row-cols-lg-4 row-cols-xl-5 g-4">
|
|
61
35
|
${iconNames
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<svg class="qld-icon-xl" aria-label="${_removePrefixQGDS(name)} icon" role="img" width="32" height="32" viewBox="0 0 32 32" focusable="false">
|
|
36
|
+
.map((name) => {
|
|
37
|
+
return `
|
|
38
|
+
<div class="col">
|
|
39
|
+
<div class="card">
|
|
40
|
+
<div class="card-body" style="text-align: center">
|
|
41
|
+
<div class="mt-12 mb-4">
|
|
42
|
+
<svg class="qld-icon qld-icon-xl" aria-label="${_removePrefixQGDS(name)} icon" role="img" width="32" height="32" viewBox="0 0 32 32" focusable="false">
|
|
70
43
|
<use href="${SPRITE_PATH}#${PREFIX_QGDS}${name}" />
|
|
71
44
|
</svg>
|
|
72
45
|
</div>
|
|
73
46
|
<small>${_removePrefixQGDS(name)}</small><br><code style="font-size: 0.75rem"> #${PREFIX_QGDS}${name}</code>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
})
|
|
52
|
+
.join("")}
|
|
78
53
|
</div>
|
|
79
54
|
</div>
|
|
80
55
|
`;
|
|
@@ -87,26 +62,28 @@ export const CssIcons = () => {
|
|
|
87
62
|
<div class="container">
|
|
88
63
|
<div class="row row-cols-sm-2 row-cols-lg-4 row-cols-xl-5 g-4">
|
|
89
64
|
${iconNames
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
65
|
+
.map((name) => {
|
|
66
|
+
return `
|
|
67
|
+
<div class="col">
|
|
68
|
+
<div class="card">
|
|
69
|
+
<div class="card-body" style="text-align: center">
|
|
70
|
+
<div class="mt-12 mb-4">
|
|
95
71
|
<span class="qld-icon qld-icon-xl qld-icon-${name}"></span>
|
|
96
72
|
</div>
|
|
97
73
|
<small>${_removePrefixQGDS(name)}</small><br><code style="font-size: 0.75rem">qld-icon-${name}</code>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>`;
|
|
77
|
+
})
|
|
78
|
+
.join("")}
|
|
102
79
|
</div>
|
|
103
80
|
</div>
|
|
104
81
|
`;
|
|
105
82
|
};
|
|
106
83
|
CssIcons.storyName = "CSS Icons";
|
|
107
84
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
85
|
+
export const Sizes = () => storySizesHtml;
|
|
86
|
+
|
|
87
|
+
export const FlexContainer = () => storyFlexContainerHtml;
|
|
112
88
|
|
|
89
|
+
export const InlineWithText = () => storyInlineWithTextHtml;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Sizes } from "../icons.stories";
|
|
2
|
+
import { Story } from "@storybook/blocks";
|
|
3
|
+
|
|
4
|
+
## Sizes
|
|
5
|
+
|
|
6
|
+
We have 6 preset sizes for icons ranging from extra small (xs) to extra
|
|
7
|
+
extra large (xxl) and a dedicated feature size for large or detailed icons.
|
|
8
|
+
Feature icons use a background shade to help make it stand out from other
|
|
9
|
+
elements on the page.
|
|
10
|
+
|
|
11
|
+
This size range allows for flexibility and adaptability in various design
|
|
12
|
+
contexts while maintaining visual harmony and balance. These predefined
|
|
13
|
+
sizes ensure that icons are proportionate and legible, enhancing their
|
|
14
|
+
effectiveness and the overall aesthetic of the site.
|
|
15
|
+
|
|
16
|
+
<Story of={Sizes} />
|
|
17
|
+
|
|
18
|
+
#### Usage
|
|
19
|
+
|
|
20
|
+
Combine base class <code>qld-icon</code> with specific icon name and size
|
|
21
|
+
class as listed here to set the icon size.
|
|
22
|
+
|
|
23
|
+
<table class="table table-responsive">
|
|
24
|
+
<thead class="table-light">
|
|
25
|
+
<tr>
|
|
26
|
+
<th scope="col">Class</th>
|
|
27
|
+
<th scope="col">REM size</th>
|
|
28
|
+
<th scope="col">Pixel size</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>
|
|
34
|
+
<code>.qld-icon-xs</code>
|
|
35
|
+
</td>
|
|
36
|
+
<td>
|
|
37
|
+
<pre>1rem</pre>
|
|
38
|
+
</td>
|
|
39
|
+
<td>
|
|
40
|
+
<pre>16x16</pre>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>
|
|
45
|
+
<code>.qld-icon-sm</code>
|
|
46
|
+
</td>
|
|
47
|
+
<td>
|
|
48
|
+
<pre>1.25rem</pre>
|
|
49
|
+
</td>
|
|
50
|
+
<td>
|
|
51
|
+
<pre>20x20</pre>
|
|
52
|
+
</td>
|
|
53
|
+
</tr>
|
|
54
|
+
<tr>
|
|
55
|
+
<td>
|
|
56
|
+
<code>.qld-icon-md</code>
|
|
57
|
+
</td>
|
|
58
|
+
<td>
|
|
59
|
+
<pre>1.5rem</pre>
|
|
60
|
+
</td>
|
|
61
|
+
<td>
|
|
62
|
+
<pre>24x24</pre>
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td>
|
|
67
|
+
<code>.qld-icon-lg</code>
|
|
68
|
+
</td>
|
|
69
|
+
<td>
|
|
70
|
+
<pre>2rem</pre>
|
|
71
|
+
</td>
|
|
72
|
+
<td>
|
|
73
|
+
<pre>32x32</pre>
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td>
|
|
78
|
+
<code>.qld-icon-xl</code>
|
|
79
|
+
</td>
|
|
80
|
+
<td>
|
|
81
|
+
<pre>2.5rem</pre>
|
|
82
|
+
</td>
|
|
83
|
+
<td>
|
|
84
|
+
<pre>40x40</pre>
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td>
|
|
89
|
+
<code>.qld-icon-xxl</code>
|
|
90
|
+
</td>
|
|
91
|
+
<td>
|
|
92
|
+
<pre>3rem</pre>
|
|
93
|
+
</td>
|
|
94
|
+
<td>
|
|
95
|
+
<pre>48x48</pre>
|
|
96
|
+
</td>
|
|
97
|
+
</tr>
|
|
98
|
+
</tbody>
|
|
99
|
+
</table>
|
|
100
|
+
|
|
101
|
+
<h5 class="mt-5">Example code:</h5>
|
|
102
|
+
|
|
103
|
+
{/* prettier-ignore-start */}
|
|
104
|
+
```html
|
|
105
|
+
<span class="qld-icon qld-icon-xxl qld-icon-design" aria-hidden="true"></span>
|
|
106
|
+
<span class="qld-icon qld-icon-xl qld-icon-design" aria-hidden="true"></span>
|
|
107
|
+
<span class="qld-icon qld-icon-lg qld-icon-design" aria-hidden="true"></span>
|
|
108
|
+
<span class="qld-icon qld-icon-md qld-icon-design" aria-hidden="true"></span>
|
|
109
|
+
<span class="qld-icon qld-icon-sm qld-icon-design" aria-hidden="true"></span>
|
|
110
|
+
<span class="qld-icon qld-icon-xs qld-icon-design" aria-hidden="true"></span>
|
|
111
|
+
```
|
|
112
|
+
{/* prettier-ignore-end */}
|