|
| 1 | +--- |
| 2 | +/** |
| 3 | + * GDPR Consent Component Download Layout |
| 4 | + */ |
| 5 | +
|
| 6 | +import type { ConsentCheckboxProps } from './@types' |
| 7 | +
|
| 8 | +export type Props = Omit<ConsentCheckboxProps, 'variant'> |
| 9 | +
|
| 10 | +const { |
| 11 | + purpose, |
| 12 | + privacyPolicyUrl, |
| 13 | + cookiePolicyUrl, |
| 14 | + name, |
| 15 | + id, |
| 16 | + formId, |
| 17 | +} = Astro.props |
| 18 | +--- |
| 19 | + |
| 20 | +<div |
| 21 | + class="pt-2 border-t border-(--color-blue-500) mb-4" |
| 22 | + id={`${id}-container`} |
| 23 | + data-component="gdpr-consent" |
| 24 | + data-purpose={purpose} |
| 25 | + data-form-id={formId} |
| 26 | +> |
| 27 | + <label class="flex items-start gap-2 cursor-pointer mt-2"> |
| 28 | + <input |
| 29 | + type="checkbox" |
| 30 | + name={name} |
| 31 | + id={id} |
| 32 | + value="true" |
| 33 | + aria-labelledby={`${id}-label`} |
| 34 | + aria-describedby={`${id}-description`} |
| 35 | + aria-invalid="false" |
| 36 | + class="relative h-4 w-4 shrink-0 appearance-none rounded border border-(--color-blue-300) bg-blue-800/40 |
| 37 | + outline-none hover:border-(--color-blue-200) hover:bg-blue-700/40 focus:outline-none |
| 38 | + focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 |
| 39 | + checked:border-white checked:bg-white checked:after:content-[''] checked:after:absolute |
| 40 | + checked:after:inset-0.75 checked:after:rounded-xs checked:after:bg-blue-700 |
| 41 | + after:pointer-events-none after:absolute after:inset-0 after:border-2 after:border-transparent |
| 42 | + focus-visible:after:-inset-1 focus-visible:after:border-white mt-1" |
| 43 | + /> |
| 44 | + <span id={`${id}-label`} class="sr-only">Consent to data processing</span> |
| 45 | + <span id={`${id}-description`} class="text-sm text-(--color-blue-100) leading-tight ml-2"> |
| 46 | + I consent to Webstack Builders processing my personal data for {purpose}. See our{' '} |
| 47 | + <a |
| 48 | + href={privacyPolicyUrl} |
| 49 | + class="text-white underline decoration-current hover:text-(--color-blue-100) focus-visible:text-(--color-blue-100)" |
| 50 | + > |
| 51 | + Privacy Policy |
| 52 | + </a>{' '} |
| 53 | + and{' '} |
| 54 | + <a |
| 55 | + href={cookiePolicyUrl} |
| 56 | + class="text-white underline decoration-current hover:text-(--color-blue-100) focus-visible:text-(--color-blue-100)" |
| 57 | + > |
| 58 | + Cookie Policy |
| 59 | + </a> |
| 60 | + . |
| 61 | + </span> |
| 62 | + </label> |
| 63 | + |
| 64 | + <div |
| 65 | + class="bg-danger-offset text-danger text-sm rounded mt-2 p-2 hidden" |
| 66 | + id={`${id}-error`} |
| 67 | + role="alert" |
| 68 | + aria-live="assertive" |
| 69 | + > |
| 70 | + </div> |
| 71 | + |
| 72 | + <input |
| 73 | + type="hidden" |
| 74 | + name={name} |
| 75 | + value="true" |
| 76 | + id={`${id}-hidden`} |
| 77 | + data-consent-hidden="true" |
| 78 | + disabled |
| 79 | + /> |
| 80 | + |
| 81 | + <input |
| 82 | + type="hidden" |
| 83 | + name="DataSubjectId" |
| 84 | + value="" |
| 85 | + id={`${id}-data-subject-id`} |
| 86 | + data-consent-data-subject-id="true" |
| 87 | + disabled |
| 88 | + /> |
| 89 | +</div> |
0 commit comments