spoko-design-system 1.19.0 → 1.20.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/.claude/settings.json +48 -48
- package/.github/dependabot.yml +11 -11
- package/.github/todo.yml +3 -3
- package/.github/workflows/claude.yml +37 -37
- package/.github/workflows/code-quality.yml +72 -72
- package/.github/workflows/deploy.yml +43 -43
- package/.husky/README.md +41 -41
- package/.husky/commit-msg +1 -1
- package/.husky/pre-commit +40 -40
- package/.prettierignore +14 -14
- package/.prettierrc +30 -30
- package/.stackblitzrc +5 -5
- package/.vscode/extensions.json +4 -4
- package/.vscode/launch.json +11 -11
- package/.vscode/settings.json +21 -21
- package/CHANGELOG.md +462 -456
- package/CLAUDE.md +268 -268
- package/LICENSE +21 -21
- package/README.md +303 -132
- package/TOOLTIPS.md +236 -236
- package/astro.config.mjs +84 -84
- package/commitlint.config.js +3 -3
- package/dev-dist/sw.js +91 -91
- package/dev-dist/workbox-c676b6d3.js +3391 -3391
- package/eslint.config.js +70 -70
- package/icon.config.ts +348 -348
- package/index.ts +78 -78
- package/package.json +160 -160
- package/public/arrow-bottom.svg +7 -7
- package/public/fonts/lg.svg +53 -53
- package/public/fonts/vwhead-bold-demo.html +549 -549
- package/public/fonts/vwhead-regular-demo.html +549 -549
- package/public/fonts/vwtext-bold-demo.html +549 -549
- package/public/fonts/vwtext-regular-demo.html +549 -549
- package/public/github.svg +3 -3
- package/public/grid_dot.svg +4 -4
- package/public/linkedin.svg +44 -44
- package/public/make-scrollable-code-focusable.js +3 -3
- package/public/pagefind.yml +3 -3
- package/public/polo.blue.svg +29 -29
- package/public/spoko.space.svg +71 -71
- package/public/twitter.svg +46 -46
- package/renovate.json +6 -6
- package/sandbox.config.json +11 -11
- package/sonar-project.properties +26 -26
- package/src/components/Category/CategoryDetails.astro +46 -18
- package/src/pages/components/badges.mdx +57 -57
- package/src/pages/components/breadcrumbs.mdx +139 -139
- package/src/pages/components/buttons.mdx +359 -359
- package/src/pages/components/card.mdx +294 -294
- package/src/pages/components/carousel.mdx +62 -62
- package/src/pages/components/copyright.mdx +42 -42
- package/src/pages/components/details-list.mdx +207 -207
- package/src/pages/components/features-list.mdx +37 -37
- package/src/pages/components/flags.mdx +49 -49
- package/src/pages/components/fuck-russia.mdx +39 -39
- package/src/pages/components/hand-drive.mdx +78 -78
- package/src/pages/components/headline.mdx +337 -337
- package/src/pages/components/image.mdx +513 -513
- package/src/pages/components/input.mdx +367 -367
- package/src/pages/components/jumbotron.mdx +530 -530
- package/src/pages/components/modal.mdx +212 -212
- package/src/pages/components/post-header.mdx +64 -64
- package/src/pages/components/pr-code.mdx +213 -213
- package/src/pages/components/product-engine.mdx +418 -418
- package/src/pages/components/product-number.mdx +58 -58
- package/src/pages/components/product-tile.mdx +51 -51
- package/src/pages/components/quote.mdx +33 -33
- package/src/pages/components/slimbanner.mdx +260 -260
- package/src/pages/components/table.mdx +108 -108
- package/src/pages/core/colors.mdx +21 -21
- package/src/pages/core/grid.mdx +193 -193
- package/src/pages/core/introduction.mdx +77 -77
- package/src/pages/core/tooltips.mdx +491 -491
- package/src/pages/patterns/introduction.mdx +60 -60
- package/src/styles/_variables.scss +70 -70
- package/tailwind.config.cjs +8 -8
- package/tsconfig.json +28 -28
- package/uno-config/index.ts +269 -269
- package/uno-config/theme/breakpoints.ts +9 -9
- package/uno-config/theme/colors.ts +65 -65
- package/uno-config/theme/dimensions.ts +17 -17
- package/uno-config/theme/effects.ts +14 -14
- package/uno-config/theme/grid.ts +10 -10
- package/uno-config/theme/index.ts +26 -26
- package/uno-config/theme/shortcuts/buttons.ts +53 -53
- package/uno-config/theme/shortcuts/components.ts +124 -124
- package/uno-config/theme/shortcuts/index.ts +20 -20
- package/uno-config/theme/shortcuts/jumbotron.ts +71 -71
- package/uno-config/theme/shortcuts/layout.ts +75 -75
- package/uno-config/theme/typography.ts +29 -29
- package/uno.config.ts +2 -2
|
@@ -1,260 +1,260 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "SlimBanner"
|
|
3
|
-
layout: "../../layouts/MainLayout.astro"
|
|
4
|
-
---
|
|
5
|
-
import SlimBanner from '../../components/SlimBanner.vue'
|
|
6
|
-
|
|
7
|
-
# SlimBanner
|
|
8
|
-
|
|
9
|
-
A flexible banner component for announcements, alerts, or calls to action. Supports custom messages, links, icons, and toggle states.
|
|
10
|
-
|
|
11
|
-
## Basic Example (Ukraine Solidarity)
|
|
12
|
-
|
|
13
|
-
<div class="component-preview">
|
|
14
|
-
<SlimBanner
|
|
15
|
-
class="w-full drop-shadow"
|
|
16
|
-
client:load
|
|
17
|
-
message="We stand with our friends and colleagues in Ukraine. To support Ukraine in their time of need visit"
|
|
18
|
-
linkText="this page"
|
|
19
|
-
linkUrl="https://polo.blue/support-ukraine/"
|
|
20
|
-
linkTitle="Support Ukraine"
|
|
21
|
-
showIcon
|
|
22
|
-
showCloseButton
|
|
23
|
-
toggleMessage="RUSSIA IS A TERRORIST STATE"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
```astro
|
|
28
|
-
<SlimBanner
|
|
29
|
-
class="w-full drop-shadow"
|
|
30
|
-
client:load
|
|
31
|
-
message="We stand with our friends and colleagues in Ukraine. To support Ukraine in their time of need visit"
|
|
32
|
-
linkText="this page"
|
|
33
|
-
linkUrl="https://polo.blue/support-ukraine/"
|
|
34
|
-
linkTitle="Support Ukraine"
|
|
35
|
-
showIcon
|
|
36
|
-
showCloseButton
|
|
37
|
-
toggleMessage="RUSSIA IS A TERRORIST STATE"
|
|
38
|
-
/>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Simple Announcement
|
|
42
|
-
|
|
43
|
-
<div class="component-preview">
|
|
44
|
-
<SlimBanner
|
|
45
|
-
class="w-full drop-shadow"
|
|
46
|
-
client:load
|
|
47
|
-
message="🎉 New features are now available!"
|
|
48
|
-
linkText="Learn more"
|
|
49
|
-
linkUrl="/updates"
|
|
50
|
-
showCloseButton={false}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
```astro
|
|
55
|
-
<SlimBanner
|
|
56
|
-
message="🎉 New features are now available!"
|
|
57
|
-
linkText="Learn more"
|
|
58
|
-
linkUrl="/updates"
|
|
59
|
-
showCloseButton={false}
|
|
60
|
-
/>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Custom Message with Link
|
|
64
|
-
|
|
65
|
-
<div class="component-preview">
|
|
66
|
-
<SlimBanner
|
|
67
|
-
class="w-full drop-shadow"
|
|
68
|
-
client:load
|
|
69
|
-
message="Limited time offer! Get 50% off all products. "
|
|
70
|
-
linkText="Shop now"
|
|
71
|
-
linkUrl="/shop"
|
|
72
|
-
linkTitle="Visit our shop"
|
|
73
|
-
showCloseButton={false}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
```astro
|
|
78
|
-
<SlimBanner
|
|
79
|
-
message="Limited time offer! Get 50% off all products. "
|
|
80
|
-
linkText="Shop now"
|
|
81
|
-
linkUrl="/shop"
|
|
82
|
-
linkTitle="Visit our shop"
|
|
83
|
-
showCloseButton={false}
|
|
84
|
-
/>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## With Toggle State
|
|
88
|
-
|
|
89
|
-
<div class="component-preview">
|
|
90
|
-
<SlimBanner
|
|
91
|
-
class="w-full drop-shadow"
|
|
92
|
-
client:load
|
|
93
|
-
message="Join us at the annual car meet this weekend!"
|
|
94
|
-
linkText="See the lineup"
|
|
95
|
-
linkUrl="/events"
|
|
96
|
-
showCloseButton
|
|
97
|
-
toggleMessage="🏁 TORQUE IS EVERYTHING"
|
|
98
|
-
toggleBgClass="bg-red-700"
|
|
99
|
-
toggleTextClass="text-white"
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
```astro
|
|
104
|
-
<SlimBanner
|
|
105
|
-
message="Join us at the annual car meet this weekend!"
|
|
106
|
-
linkText="See the lineup"
|
|
107
|
-
linkUrl="/events"
|
|
108
|
-
showCloseButton
|
|
109
|
-
toggleMessage="🏁 TORQUE IS EVERYTHING"
|
|
110
|
-
toggleBgClass="bg-red-700"
|
|
111
|
-
toggleTextClass="text-white"
|
|
112
|
-
/>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Message Only (No Link)
|
|
116
|
-
|
|
117
|
-
<div class="component-preview">
|
|
118
|
-
<SlimBanner
|
|
119
|
-
class="w-full drop-shadow"
|
|
120
|
-
client:load
|
|
121
|
-
message="Scheduled maintenance: The site will be down on Sunday, 3-5 AM EST."
|
|
122
|
-
linkUrl=""
|
|
123
|
-
showCloseButton={false}
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
```astro
|
|
128
|
-
<SlimBanner
|
|
129
|
-
message="Scheduled maintenance: The site will be down on Sunday, 3-5 AM EST."
|
|
130
|
-
linkUrl=""
|
|
131
|
-
showCloseButton={false}
|
|
132
|
-
/>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Persistent Banner (LocalStorage)
|
|
136
|
-
|
|
137
|
-
Close the banner permanently using localStorage. It will stay hidden even after page refresh.
|
|
138
|
-
|
|
139
|
-
<div class="component-preview">
|
|
140
|
-
<SlimBanner
|
|
141
|
-
class="w-full drop-shadow"
|
|
142
|
-
client:load
|
|
143
|
-
message="🍪 This website uses cookies to enhance your experience."
|
|
144
|
-
linkText="Learn more"
|
|
145
|
-
linkUrl="/privacy"
|
|
146
|
-
showCloseButton
|
|
147
|
-
persistClose
|
|
148
|
-
storageKey="cookie-banner-closed"
|
|
149
|
-
expirationDays={90}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
```astro
|
|
154
|
-
<SlimBanner
|
|
155
|
-
message="🍪 This website uses cookies to enhance your experience."
|
|
156
|
-
linkText="Learn more"
|
|
157
|
-
linkUrl="/privacy"
|
|
158
|
-
showCloseButton
|
|
159
|
-
persistClose
|
|
160
|
-
storageKey="cookie-banner-closed"
|
|
161
|
-
expirationDays={90}
|
|
162
|
-
/>
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**Note:** Once you close this banner, it won't show again for 90 days (or until you clear localStorage).
|
|
166
|
-
|
|
167
|
-
## Persistent with No Expiration
|
|
168
|
-
|
|
169
|
-
<div class="component-preview">
|
|
170
|
-
<SlimBanner
|
|
171
|
-
class="w-full drop-shadow"
|
|
172
|
-
client:load
|
|
173
|
-
message="📢 Important: This is a one-time announcement."
|
|
174
|
-
linkUrl=""
|
|
175
|
-
showCloseButton
|
|
176
|
-
persistClose
|
|
177
|
-
storageKey="announcement-dismissed"
|
|
178
|
-
expirationDays={0}
|
|
179
|
-
/>
|
|
180
|
-
</div>
|
|
181
|
-
|
|
182
|
-
```astro
|
|
183
|
-
<SlimBanner
|
|
184
|
-
message="📢 Important: This is a one-time announcement."
|
|
185
|
-
linkUrl=""
|
|
186
|
-
showCloseButton
|
|
187
|
-
persistClose
|
|
188
|
-
storageKey="announcement-dismissed"
|
|
189
|
-
expirationDays={0}
|
|
190
|
-
/>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**Tip:** Set `expirationDays={0}` to hide the banner forever once closed.
|
|
194
|
-
|
|
195
|
-
## Props
|
|
196
|
-
|
|
197
|
-
| Prop | Type | Default | Description |
|
|
198
|
-
|------|------|---------|-------------|
|
|
199
|
-
| `message` | String | Ukraine message | Main banner message text |
|
|
200
|
-
| `linkText` | String | `'this page'` | Text for the link |
|
|
201
|
-
| `linkUrl` | String | Ukraine URL | URL for the link (set to empty string for no link) |
|
|
202
|
-
| `linkTitle` | String | `''` | Title attribute for the link |
|
|
203
|
-
| `toggleMessage` | String | `''` | Message to show when close button is clicked (enables toggle) |
|
|
204
|
-
| `toggleBgClass` | String | `'bg-black'` | Background class for toggle state |
|
|
205
|
-
| `toggleTextClass` | String | `'text-white'` | Text color class for toggle state |
|
|
206
|
-
| `showCloseButton` | Boolean | `true` | Show close/toggle button |
|
|
207
|
-
| `closeButtonAriaLabel` | String | `'Toggle'` | Aria label for close button |
|
|
208
|
-
| `showIcon` | Boolean | `false` | Show icon (Ukraine flag by default) |
|
|
209
|
-
| `iconClass` | String | Ukraine flag CSS | Custom CSS class for icon |
|
|
210
|
-
| `persistClose` | Boolean | `false` | Save close state to localStorage |
|
|
211
|
-
| `storageKey` | String | `'slimbanner-closed'` | localStorage key for persistence |
|
|
212
|
-
| `expirationDays` | Number | `30` | Days until localStorage expires (0 = never) |
|
|
213
|
-
|
|
214
|
-
## Slots
|
|
215
|
-
|
|
216
|
-
| Slot | Description |
|
|
217
|
-
|------|-------------|
|
|
218
|
-
| `default` | Override the entire message content |
|
|
219
|
-
| `icon` | Override the icon/flag |
|
|
220
|
-
| `toggle` | Override the toggle state content |
|
|
221
|
-
|
|
222
|
-
## Using Slots
|
|
223
|
-
|
|
224
|
-
```astro
|
|
225
|
-
<SlimBanner client:load>
|
|
226
|
-
<strong slot="default">Custom content</strong> with <em>HTML markup</em>
|
|
227
|
-
</SlimBanner>
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## LocalStorage Management
|
|
231
|
-
|
|
232
|
-
When using `persistClose={true}`, the close state is saved to localStorage. Here's how to manage it:
|
|
233
|
-
|
|
234
|
-
### Clear specific banner:
|
|
235
|
-
```javascript
|
|
236
|
-
localStorage.removeItem('cookie-banner-closed');
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Clear all banners:
|
|
240
|
-
```javascript
|
|
241
|
-
// If using default key
|
|
242
|
-
localStorage.removeItem('slimbanner-closed');
|
|
243
|
-
|
|
244
|
-
// Or clear all by pattern
|
|
245
|
-
Object.keys(localStorage)
|
|
246
|
-
.filter(key => key.includes('banner'))
|
|
247
|
-
.forEach(key => localStorage.removeItem(key));
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Check if banner is closed:
|
|
251
|
-
```javascript
|
|
252
|
-
const data = JSON.parse(localStorage.getItem('cookie-banner-closed'));
|
|
253
|
-
console.log('Banner closed:', data?.closed);
|
|
254
|
-
console.log('Expires at:', new Date(data?.expires));
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## uno.config.ts / shortcuts
|
|
258
|
-
```js
|
|
259
|
-
['slimbanner','px-4 sm:px-8 flex items-center justify-center text-xs sm:text-base leading-none relative bg-gray-100 z-2 px-4 py-3 sm:(text-base px-8) text-blue-darker print-hidden'],
|
|
260
|
-
```
|
|
1
|
+
---
|
|
2
|
+
title: "SlimBanner"
|
|
3
|
+
layout: "../../layouts/MainLayout.astro"
|
|
4
|
+
---
|
|
5
|
+
import SlimBanner from '../../components/SlimBanner.vue'
|
|
6
|
+
|
|
7
|
+
# SlimBanner
|
|
8
|
+
|
|
9
|
+
A flexible banner component for announcements, alerts, or calls to action. Supports custom messages, links, icons, and toggle states.
|
|
10
|
+
|
|
11
|
+
## Basic Example (Ukraine Solidarity)
|
|
12
|
+
|
|
13
|
+
<div class="component-preview">
|
|
14
|
+
<SlimBanner
|
|
15
|
+
class="w-full drop-shadow"
|
|
16
|
+
client:load
|
|
17
|
+
message="We stand with our friends and colleagues in Ukraine. To support Ukraine in their time of need visit"
|
|
18
|
+
linkText="this page"
|
|
19
|
+
linkUrl="https://polo.blue/support-ukraine/"
|
|
20
|
+
linkTitle="Support Ukraine"
|
|
21
|
+
showIcon
|
|
22
|
+
showCloseButton
|
|
23
|
+
toggleMessage="RUSSIA IS A TERRORIST STATE"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
```astro
|
|
28
|
+
<SlimBanner
|
|
29
|
+
class="w-full drop-shadow"
|
|
30
|
+
client:load
|
|
31
|
+
message="We stand with our friends and colleagues in Ukraine. To support Ukraine in their time of need visit"
|
|
32
|
+
linkText="this page"
|
|
33
|
+
linkUrl="https://polo.blue/support-ukraine/"
|
|
34
|
+
linkTitle="Support Ukraine"
|
|
35
|
+
showIcon
|
|
36
|
+
showCloseButton
|
|
37
|
+
toggleMessage="RUSSIA IS A TERRORIST STATE"
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Simple Announcement
|
|
42
|
+
|
|
43
|
+
<div class="component-preview">
|
|
44
|
+
<SlimBanner
|
|
45
|
+
class="w-full drop-shadow"
|
|
46
|
+
client:load
|
|
47
|
+
message="🎉 New features are now available!"
|
|
48
|
+
linkText="Learn more"
|
|
49
|
+
linkUrl="/updates"
|
|
50
|
+
showCloseButton={false}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
```astro
|
|
55
|
+
<SlimBanner
|
|
56
|
+
message="🎉 New features are now available!"
|
|
57
|
+
linkText="Learn more"
|
|
58
|
+
linkUrl="/updates"
|
|
59
|
+
showCloseButton={false}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Custom Message with Link
|
|
64
|
+
|
|
65
|
+
<div class="component-preview">
|
|
66
|
+
<SlimBanner
|
|
67
|
+
class="w-full drop-shadow"
|
|
68
|
+
client:load
|
|
69
|
+
message="Limited time offer! Get 50% off all products. "
|
|
70
|
+
linkText="Shop now"
|
|
71
|
+
linkUrl="/shop"
|
|
72
|
+
linkTitle="Visit our shop"
|
|
73
|
+
showCloseButton={false}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
```astro
|
|
78
|
+
<SlimBanner
|
|
79
|
+
message="Limited time offer! Get 50% off all products. "
|
|
80
|
+
linkText="Shop now"
|
|
81
|
+
linkUrl="/shop"
|
|
82
|
+
linkTitle="Visit our shop"
|
|
83
|
+
showCloseButton={false}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## With Toggle State
|
|
88
|
+
|
|
89
|
+
<div class="component-preview">
|
|
90
|
+
<SlimBanner
|
|
91
|
+
class="w-full drop-shadow"
|
|
92
|
+
client:load
|
|
93
|
+
message="Join us at the annual car meet this weekend!"
|
|
94
|
+
linkText="See the lineup"
|
|
95
|
+
linkUrl="/events"
|
|
96
|
+
showCloseButton
|
|
97
|
+
toggleMessage="🏁 TORQUE IS EVERYTHING"
|
|
98
|
+
toggleBgClass="bg-red-700"
|
|
99
|
+
toggleTextClass="text-white"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
```astro
|
|
104
|
+
<SlimBanner
|
|
105
|
+
message="Join us at the annual car meet this weekend!"
|
|
106
|
+
linkText="See the lineup"
|
|
107
|
+
linkUrl="/events"
|
|
108
|
+
showCloseButton
|
|
109
|
+
toggleMessage="🏁 TORQUE IS EVERYTHING"
|
|
110
|
+
toggleBgClass="bg-red-700"
|
|
111
|
+
toggleTextClass="text-white"
|
|
112
|
+
/>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Message Only (No Link)
|
|
116
|
+
|
|
117
|
+
<div class="component-preview">
|
|
118
|
+
<SlimBanner
|
|
119
|
+
class="w-full drop-shadow"
|
|
120
|
+
client:load
|
|
121
|
+
message="Scheduled maintenance: The site will be down on Sunday, 3-5 AM EST."
|
|
122
|
+
linkUrl=""
|
|
123
|
+
showCloseButton={false}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
```astro
|
|
128
|
+
<SlimBanner
|
|
129
|
+
message="Scheduled maintenance: The site will be down on Sunday, 3-5 AM EST."
|
|
130
|
+
linkUrl=""
|
|
131
|
+
showCloseButton={false}
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Persistent Banner (LocalStorage)
|
|
136
|
+
|
|
137
|
+
Close the banner permanently using localStorage. It will stay hidden even after page refresh.
|
|
138
|
+
|
|
139
|
+
<div class="component-preview">
|
|
140
|
+
<SlimBanner
|
|
141
|
+
class="w-full drop-shadow"
|
|
142
|
+
client:load
|
|
143
|
+
message="🍪 This website uses cookies to enhance your experience."
|
|
144
|
+
linkText="Learn more"
|
|
145
|
+
linkUrl="/privacy"
|
|
146
|
+
showCloseButton
|
|
147
|
+
persistClose
|
|
148
|
+
storageKey="cookie-banner-closed"
|
|
149
|
+
expirationDays={90}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
```astro
|
|
154
|
+
<SlimBanner
|
|
155
|
+
message="🍪 This website uses cookies to enhance your experience."
|
|
156
|
+
linkText="Learn more"
|
|
157
|
+
linkUrl="/privacy"
|
|
158
|
+
showCloseButton
|
|
159
|
+
persistClose
|
|
160
|
+
storageKey="cookie-banner-closed"
|
|
161
|
+
expirationDays={90}
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Note:** Once you close this banner, it won't show again for 90 days (or until you clear localStorage).
|
|
166
|
+
|
|
167
|
+
## Persistent with No Expiration
|
|
168
|
+
|
|
169
|
+
<div class="component-preview">
|
|
170
|
+
<SlimBanner
|
|
171
|
+
class="w-full drop-shadow"
|
|
172
|
+
client:load
|
|
173
|
+
message="📢 Important: This is a one-time announcement."
|
|
174
|
+
linkUrl=""
|
|
175
|
+
showCloseButton
|
|
176
|
+
persistClose
|
|
177
|
+
storageKey="announcement-dismissed"
|
|
178
|
+
expirationDays={0}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
```astro
|
|
183
|
+
<SlimBanner
|
|
184
|
+
message="📢 Important: This is a one-time announcement."
|
|
185
|
+
linkUrl=""
|
|
186
|
+
showCloseButton
|
|
187
|
+
persistClose
|
|
188
|
+
storageKey="announcement-dismissed"
|
|
189
|
+
expirationDays={0}
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Tip:** Set `expirationDays={0}` to hide the banner forever once closed.
|
|
194
|
+
|
|
195
|
+
## Props
|
|
196
|
+
|
|
197
|
+
| Prop | Type | Default | Description |
|
|
198
|
+
|------|------|---------|-------------|
|
|
199
|
+
| `message` | String | Ukraine message | Main banner message text |
|
|
200
|
+
| `linkText` | String | `'this page'` | Text for the link |
|
|
201
|
+
| `linkUrl` | String | Ukraine URL | URL for the link (set to empty string for no link) |
|
|
202
|
+
| `linkTitle` | String | `''` | Title attribute for the link |
|
|
203
|
+
| `toggleMessage` | String | `''` | Message to show when close button is clicked (enables toggle) |
|
|
204
|
+
| `toggleBgClass` | String | `'bg-black'` | Background class for toggle state |
|
|
205
|
+
| `toggleTextClass` | String | `'text-white'` | Text color class for toggle state |
|
|
206
|
+
| `showCloseButton` | Boolean | `true` | Show close/toggle button |
|
|
207
|
+
| `closeButtonAriaLabel` | String | `'Toggle'` | Aria label for close button |
|
|
208
|
+
| `showIcon` | Boolean | `false` | Show icon (Ukraine flag by default) |
|
|
209
|
+
| `iconClass` | String | Ukraine flag CSS | Custom CSS class for icon |
|
|
210
|
+
| `persistClose` | Boolean | `false` | Save close state to localStorage |
|
|
211
|
+
| `storageKey` | String | `'slimbanner-closed'` | localStorage key for persistence |
|
|
212
|
+
| `expirationDays` | Number | `30` | Days until localStorage expires (0 = never) |
|
|
213
|
+
|
|
214
|
+
## Slots
|
|
215
|
+
|
|
216
|
+
| Slot | Description |
|
|
217
|
+
|------|-------------|
|
|
218
|
+
| `default` | Override the entire message content |
|
|
219
|
+
| `icon` | Override the icon/flag |
|
|
220
|
+
| `toggle` | Override the toggle state content |
|
|
221
|
+
|
|
222
|
+
## Using Slots
|
|
223
|
+
|
|
224
|
+
```astro
|
|
225
|
+
<SlimBanner client:load>
|
|
226
|
+
<strong slot="default">Custom content</strong> with <em>HTML markup</em>
|
|
227
|
+
</SlimBanner>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## LocalStorage Management
|
|
231
|
+
|
|
232
|
+
When using `persistClose={true}`, the close state is saved to localStorage. Here's how to manage it:
|
|
233
|
+
|
|
234
|
+
### Clear specific banner:
|
|
235
|
+
```javascript
|
|
236
|
+
localStorage.removeItem('cookie-banner-closed');
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Clear all banners:
|
|
240
|
+
```javascript
|
|
241
|
+
// If using default key
|
|
242
|
+
localStorage.removeItem('slimbanner-closed');
|
|
243
|
+
|
|
244
|
+
// Or clear all by pattern
|
|
245
|
+
Object.keys(localStorage)
|
|
246
|
+
.filter(key => key.includes('banner'))
|
|
247
|
+
.forEach(key => localStorage.removeItem(key));
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Check if banner is closed:
|
|
251
|
+
```javascript
|
|
252
|
+
const data = JSON.parse(localStorage.getItem('cookie-banner-closed'));
|
|
253
|
+
console.log('Banner closed:', data?.closed);
|
|
254
|
+
console.log('Expires at:', new Date(data?.expires));
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## uno.config.ts / shortcuts
|
|
258
|
+
```js
|
|
259
|
+
['slimbanner','px-4 sm:px-8 flex items-center justify-center text-xs sm:text-base leading-none relative bg-gray-100 z-2 px-4 py-3 sm:(text-base px-8) text-blue-darker print-hidden'],
|
|
260
|
+
```
|