Skip to content

Commit 8bbe83a

Browse files
committed
Update ConsentBanner, Copy, Footer and Consent Page to use Button component
1 parent 1cb35c4 commit 8bbe83a

5 files changed

Lines changed: 30 additions & 24 deletions

File tree

‎src/components/Consent/Banner/index.astro‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import { Image } from 'astro:assets'
3-
import Icon from '@components/Icon/index.astro'
43
import Button from '@components/Button/index.astro'
54
import CookieSvg from '@assets/images/site/cookie.svg'
65
---
@@ -18,13 +17,15 @@ import CookieSvg from '@assets/images/site/cookie.svg'
1817
>
1918
<h2 id="consent-modal__title" class="sr-only">Cookie consent</h2>
2019
<!-- Close button positioned at far right of viewport -->
21-
<button
20+
<Button
2221
type="button"
23-
aria-label="Close cookie consent"
22+
variant="icon"
23+
ariaLabel="Close cookie consent"
24+
icon="close"
25+
iconPosition="only"
26+
iconSize={8}
2427
class="consent-modal__close-btn bg-spotlight border-none flex p-1.5 absolute top-0 right-0 transition-all duration-150 ease-in-out hover:bg-spotlight-offset focus:bg-spotlight-offset focus:outline-none z-(--z-raised)"
25-
>
26-
<Icon icon="close" size={8} />
27-
</button>
28+
/>
2829

2930
<!-- Modal content container with page column constraints -->
3031
<div

‎src/components/Consent/Checkbox/client/__fixtures__/checkbox.fixture.astro‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import Button from '@components/Button/index.astro'
23
import ConsentCheckbox from '@components/Consent/Checkbox/index.astro'
34
import type { CheckboxFixtureProps } from '@components/Consent/Checkbox/client/types'
45
@@ -16,7 +17,7 @@ const { wrapInForm = true, ...props } = fixtureProps
1617
wrapInForm ? (
1718
<form id="gdpr-consent-form" data-testid="gdpr-consent-form">
1819
<ConsentCheckbox {...props} />
19-
<button type="submit">Submit</button>
20+
<Button type="submit" text="Submit" />
2021
</form>
2122
) : (
2223
<ConsentCheckbox {...props} />

‎src/components/Copy/index.astro‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const iconButtonColorClass = [
6060
<slot />
6161
</span>
6262

63+
{/** Not using Button component intentionally */}
6364
<button
6465
{...rest}
6566
class:list={[buttonClass, iconButtonColorClass, floatButtonClass]}

‎src/components/Footer/index.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ const iconButtonClasses = [
235235
<Icon icon="feed" color="inherit" size={8} />
236236
</a>
237237

238-
{/* Page footer Bug Reporter trigger */}
238+
{/* Page footer Bug Reporter trigger. Not using Button component intentionally. */}
239239
<button
240240
id="bugReporterTrigger"
241241
type="button"

‎src/components/Pages/Consent/index.astro‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import HeadingAnchor from '@components/Layout/HeadingAnchor/index.astro'
33
import Icon from '@components/Icon/index.astro'
44
import List from '@components/List/index.astro'
5+
import Button from '@components/Button/index.astro'
56
import UnsavedConsentDialog from '@components/Pages/Consent/unsaved.astro'
67
78
export type Props = {
@@ -231,26 +232,28 @@ const { content } = Astro.props
231232
</div>
232233

233234
<div class="px-6 py-4 flex gap-3 justify-end flex-wrap">
234-
<button
235+
<Button
236+
type="button"
235237
id="consent-allow-all"
236-
class="px-6 py-2 bg-success-offset text-content-inverse rounded-lg hover:bg-success transition-colors duration-200 font-medium focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
237-
>
238-
{content.buttons.acceptAll}
239-
</button>
240-
<button
238+
text={content.buttons.acceptAll}
239+
variant="success"
240+
class="px-6 py-2 rounded-lg transition-colors duration-200 font-medium! normal-case focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
241+
/>
242+
<Button
243+
type="button"
241244
id="consent-deny-all"
242-
class="px-6 py-2 bg-warning-offset text-content-inverse rounded-lg hover:bg-warning transition-colors duration-200 font-medium focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
243-
>
244-
{content.buttons.rejectAll}
245-
</button>
246-
<button
245+
text={content.buttons.rejectAll}
246+
variant="warning"
247+
class="px-6 py-2 rounded-lg transition-colors duration-200 font-medium! normal-case focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
248+
/>
249+
<Button
250+
type="button"
247251
id="consent-save-preferences"
248-
class="px-6 py-2 text-content-inverse rounded-lg cursor-not-allowed transition-colors duration-200 font-medium focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
252+
text={content.buttons.save}
253+
variant="secondary"
254+
class="px-6 py-2 bg-secondary text-content-inverse rounded-lg cursor-not-allowed hover:bg-secondary transition-colors duration-200 font-medium! normal-case focus-visible:outline-2 focus-visible:outline-spotlight focus-visible:outline-offset-2 focus-visible:rounded-none"
249255
disabled
250-
aria-disabled="true"
251-
>
252-
{content.buttons.save}
253-
</button>
256+
/>
254257
</div>
255258
</section>
256259
</consent-preferences>

0 commit comments

Comments
 (0)