|
6 | 6 | */ |
7 | 7 | import './Footer.css'; |
8 | 8 | import { Icon } from 'astro-icon/components'; |
9 | | -import { BodyMd, Col, Container, Grid } from '@/components/primitives'; |
| 9 | +import { BodyMd, Button, Col, Container, Grid } from '@/components/primitives'; |
10 | 10 | --- |
11 | 11 |
|
12 | 12 | <footer class="footer"> |
@@ -84,6 +84,20 @@ import { BodyMd, Col, Container, Grid } from '@/components/primitives'; |
84 | 84 | </Col> |
85 | 85 | <Col xs={12} md={6} lg={6}> |
86 | 86 | <ul class="footer__socials" aria-label="Social links"> |
| 87 | + <li> |
| 88 | + <Button |
| 89 | + id="kawaiiToggle" |
| 90 | + class="kawaii-toggle" |
| 91 | + type="button" |
| 92 | + aria-label="Toggle kawaii logo" |
| 93 | + aria-pressed="false" |
| 94 | + variant="secondary" |
| 95 | + size="xs" |
| 96 | + ghost |
| 97 | + > |
| 98 | + Kawaii? |
| 99 | + </Button> |
| 100 | + </li> |
87 | 101 | <li> |
88 | 102 | <a |
89 | 103 | href="https://github.com/expressjs/express" |
@@ -142,3 +156,27 @@ import { BodyMd, Col, Container, Grid } from '@/components/primitives'; |
142 | 156 | </Container> |
143 | 157 | </div> |
144 | 158 | </footer> |
| 159 | + |
| 160 | +<script> |
| 161 | + const toggle = document.getElementById('kawaiiToggle'); |
| 162 | + const isKawaii = localStorage.getItem('kawaii') === 'true'; |
| 163 | + |
| 164 | + if (isKawaii) { |
| 165 | + document.documentElement.setAttribute('data-kawaii', ''); |
| 166 | + toggle?.setAttribute('aria-pressed', 'true'); |
| 167 | + } |
| 168 | + |
| 169 | + toggle?.addEventListener('click', () => { |
| 170 | + const active = document.documentElement.hasAttribute('data-kawaii'); |
| 171 | + |
| 172 | + if (active) { |
| 173 | + document.documentElement.removeAttribute('data-kawaii'); |
| 174 | + localStorage.removeItem('kawaii'); |
| 175 | + toggle.setAttribute('aria-pressed', 'false'); |
| 176 | + } else { |
| 177 | + document.documentElement.setAttribute('data-kawaii', ''); |
| 178 | + localStorage.setItem('kawaii', 'true'); |
| 179 | + toggle.setAttribute('aria-pressed', 'true'); |
| 180 | + } |
| 181 | + }); |
| 182 | +</script> |
0 commit comments