= {
+ danger:
+ 'bg-danger text-white ' +
+ 'hover:bg-danger-offset ' +
+ 'focus-visible:bg-danger-offset ' +
+ 'active:bg-danger-offset',
+ icon:
+ 'aspect-square bg-transparent text-white p-2 ' +
+ 'hover:bg-page-offset hover:text-primary ' +
+ 'focus-visible:bg-page-offset focus-visible:text-primary ' +
+ 'active:bg-page-offset',
+ info:
+ 'bg-info text-white ' +
+ 'hover:bg-info-offset ' +
+ 'focus-visible:bg-info-offset ' +
+ 'active:bg-info-offset',
+ note:
+ 'bg-note text-white ' +
+ 'hover:bg-note-offset ' +
+ 'focus-visible:bg-note-offset ' +
+ 'active:bg-note-offset',
primary:
- 'bg-primary text-content ' +
- 'hover:bg-primary-offset hover:[box-shadow:var(--shadow-hover)] hover:-translate-y-px ' +
- 'focus-visible:bg-primary-offset focus-visible:[box-shadow:var(--shadow-hover)] focus-visible:-translate-y-px ' +
- 'active:bg-primary-offset active:[box-shadow:var(--shadow-active)] active:translate-y-px',
+ 'bg-primary text-primary-inverse ' +
+ 'hover:bg-primary-offset ' +
+ 'focus-visible:bg-primary-offset ' +
+ 'active:bg-primary-offset',
secondary:
- 'bg-secondary text-content ' +
- 'hover:bg-secondary-offset hover:[box-shadow:var(--shadow-hover)] hover:-translate-y-px ' +
- 'focus-visible:bg-secondary-offset focus-visible:[box-shadow:var(--shadow-hover)] focus-visible:-translate-y-px ' +
- 'active:bg-secondary-offset active:[box-shadow:var(--shadow-active)] active:translate-y-px',
- twitter: 'bg-x border-x text-content hover:bg-transparent hover:text-x focus-visible:bg-transparent focus-visible:text-x',
+ 'bg-secondary text-secondary-inverse ' +
+ 'hover:bg-secondary-offset ' +
+ 'focus-visible:bg-secondary-offset ' +
+ 'active:bg-secondary-offset',
success:
'bg-success text-white ' +
- 'hover:bg-success-offset hover:[box-shadow:var(--shadow-hover)] hover:-translate-y-px ' +
- 'focus-visible:bg-success-offset focus-visible:[box-shadow:var(--shadow-hover)] focus-visible:-translate-y-px ' +
- 'active:bg-success-offset active:[box-shadow:var(--shadow-active)] active:translate-y-px',
+ 'hover:bg-success-offset ' +
+ 'focus-visible:bg-success-offset ' +
+ 'active:bg-success-offset',
+ twitter:
+ 'bg-x border-x text-white ' +
+ 'hover:bg-transparent hover:text-x ' +
+ 'focus-visible:bg-transparent ' +
+ 'focus-visible:text-x',
warning:
- 'bg-warning text-content ' +
- 'hover:bg-warning-offset hover:[box-shadow:var(--shadow-hover)] hover:-translate-y-px ' +
- 'focus-visible:bg-warning-offset focus-visible:[box-shadow:var(--shadow-hover)] focus-visible:-translate-y-px ' +
- 'active:bg-warning-offset active:[box-shadow:var(--shadow-active)] active:translate-y-px',
- spotlight:
- 'bg-spotlight text-black ' +
- 'hover:bg-spotlight-offset hover:[box-shadow:var(--shadow-hover)] hover:-translate-y-px ' +
- 'focus-visible:bg-spotlight-offset focus-visible:[box-shadow:var(--shadow-hover)] focus-visible:-translate-y-px ' +
- 'active:bg-spotlight-offset active:[box-shadow:var(--shadow-active)] active:translate-y-px',
- icon:
- 'aspect-square bg-transparent text-content p-2 ![box-shadow:none] ' +
- 'hover:bg-page-offset hover:text-primary ' +
- 'focus-visible:bg-page-offset focus-visible:text-primary ' +
- 'active:bg-page-offset',
-}
+ 'bg-warning-offset text-white ' +
+ 'hover:bg-warning ' +
+ 'focus-visible:bg-warning ' +
+ 'active:bg-warning',
+ }
export interface ButtonClassOptions {
variant?: ButtonVariant
@@ -101,10 +123,15 @@ export function buildButtonClassList({
additionalClasses,
}: ButtonClassOptions) {
const classList: ClassList = {}
+ const selectedVariant = variant as string
+
+ if (!(selectedVariant in variantClasses)) {
+ throw new Error(`Button: unsupported variant '${selectedVariant}'`)
+ }
addClassNames(classList, baseButtonClasses)
addClassNames(classList, sizeClasses[size])
- addClassNames(classList, variantClasses[variant])
+ addClassNames(classList, variantClasses[selectedVariant as ButtonVariant])
if (additionalClasses?.trim()) {
addClassNames(classList, additionalClasses)
diff --git a/src/components/CallToAction/Download/index.astro b/src/components/CallToAction/Download/index.astro
index f0c96c2d2..8afe09c8a 100644
--- a/src/components/CallToAction/Download/index.astro
+++ b/src/components/CallToAction/Download/index.astro
@@ -4,6 +4,7 @@
* download page, which is implemented by Forms/Download.
*/
import { BuildError } from '@lib/errors/BuildError'
+import Button from '@components/Button/index.astro'
import List from '@components/List/index.astro'
import Icon from '@components/Icon/index.astro'
@@ -74,7 +75,7 @@ const downloadUrl = `/downloads/${normalizedResource}`
-
+
{title}
@@ -99,37 +100,38 @@ const downloadUrl = `/downloads/${normalizedResource}`
-
Free resource · Instant access
+ Free resource · Instant access
-
- {buttonText}
-
+
{buttonText}
+
{
secondaryLink && (
-
- {secondaryLink.text}
-
+ variant="secondary"
+ class="w-full mt-2 px-6 py-3 bg-page-offset text-content-inverse hover:bg-page-offset focus-visible:bg-page-offset"
+ text={secondaryLink.text}
+ />
)
}
- No credit card required.
+ No credit card required.
diff --git a/src/components/CallToAction/Newsletter/layouts/article.astro b/src/components/CallToAction/Newsletter/layouts/article.astro
index 0b73c44f7..4de74884e 100644
--- a/src/components/CallToAction/Newsletter/layouts/article.astro
+++ b/src/components/CallToAction/Newsletter/layouts/article.astro
@@ -1,6 +1,7 @@
---
import GDPRConsent from '@components/Consent/Checkbox/index.astro'
import Confetti from '@components/Animations/Confetti/index.astro'
+import Icon from '@components/Icon/index.astro'
import type { NewsletterProps } from '@components/CallToAction/Newsletter/client/@types'
export type Props = Omit
@@ -57,44 +58,18 @@ const {
class="relative px-6 py-2 bg-primary hover:bg-primary-offset text-page-base font-semibold rounded text-sm transition-colors whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none after:pointer-events-none after:absolute after:content-[''] after:inset-0 after:rounded-none after:border-2 after:border-transparent focus-visible:after:-inset-1 focus-visible:after:border-spotlight"
>
{buttonText}
-
-
+
-
-
-
+ />
diff --git a/src/components/CallToAction/Newsletter/layouts/home.astro b/src/components/CallToAction/Newsletter/layouts/home.astro
index af7d3d24d..cf440fd80 100644
--- a/src/components/CallToAction/Newsletter/layouts/home.astro
+++ b/src/components/CallToAction/Newsletter/layouts/home.astro
@@ -1,6 +1,7 @@
---
import GDPRConsent from '@components/Consent/Checkbox/index.astro'
import Confetti from '@components/Animations/Confetti/index.astro'
+import Icon from '@components/Icon/index.astro'
import type { NewsletterProps } from '@components/CallToAction/Newsletter/client/@types'
export type Props = Omit
@@ -209,44 +210,18 @@ const {
class="relative w-full px-6 py-3 bg-content text-page-base font-bold rounded-none text-sm transition-all transform hover:-translate-y-0.5 hover:shadow-lg flex items-center justify-center gap-2 group-hover/form:bg-primary disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 focus-visible:outline-none after:pointer-events-none after:absolute after:content-[''] after:inset-0 after:rounded-none after:border-2 after:border-transparent focus-visible:after:-inset-1 focus-visible:after:border-spotlight"
>
{buttonText}
-
-
+
-
-
-
+ />
@@ -68,44 +69,18 @@ const {
class="relative w-full px-6 py-3 bg-content text-page-base font-bold rounded-lg text-sm transition-all transform hover:-translate-y-0.5 hover:shadow-lg flex items-center justify-center gap-2 hover:bg-primary disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 focus-visible:outline-none after:pointer-events-none after:absolute after:content-[''] after:inset-0 after:rounded-none after:border-2 after:border-transparent focus-visible:after:-inset-1 focus-visible:after:border-spotlight"
>
{buttonText}
-
-
+
-
-
-
+ />
diff --git a/src/components/Callout/index.astro b/src/components/Callout/index.astro
index d7267ab5a..fe1a20cb1 100644
--- a/src/components/Callout/index.astro
+++ b/src/components/Callout/index.astro
@@ -43,24 +43,32 @@ const typeAccentTextClassMap = {
action: 'text-warning',
info: 'text-info',
tip: 'text-success',
- note: 'text-note',
+ note: 'text-note-offset',
success: 'text-success',
danger: 'text-danger',
} as const
+const typeBodyTextClassMap = {
+ warning: 'text-content',
+ action: 'text-content',
+ info: 'text-content',
+ tip: 'text-content',
+ note: 'text-note',
+ success: 'text-content',
+ danger: 'text-content',
+} as const
+
const icon = iconMap[type] ?? iconMap.info
const typeLabel = typeLabelMap[type] ?? typeLabelMap.info
const typeLabelUpper = typeLabel.toUpperCase()
const containerClasses = typeContainerClassMap[type] ?? typeContainerClassMap.info
const accentTextClasses = typeAccentTextClassMap[type] ?? typeAccentTextClassMap.info
+const bodyTextClasses = typeBodyTextClassMap[type] ?? typeBodyTextClassMap.info
+const iconColor = accentTextClasses.startsWith('text-') ? accentTextClasses.slice(5) : 'inherit'
---