diff --git a/src/components/markdoc/blocks/general/Reveal.astro b/src/components/markdoc/blocks/general/Reveal.astro index 4143f4a..ddc978d 100644 --- a/src/components/markdoc/blocks/general/Reveal.astro +++ b/src/components/markdoc/blocks/general/Reveal.astro @@ -5,7 +5,15 @@ const { summary = 'Spoiler' } = Astro.props ---
- {summary} + + Spoiler + + + {summary} + Reveal + + +
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index d3dad08..f6ae67b 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -43,7 +43,7 @@ const previewUrl = preview ? new URL(preview.src, Astro.site) : undefined diff --git a/src/styles/base/primitives.css b/src/styles/base/primitives.css index 25f1915..8c491dd 100644 --- a/src/styles/base/primitives.css +++ b/src/styles/base/primitives.css @@ -184,6 +184,7 @@ --slot-prose-gap: var(--size-6); --slot-prose-bar: var(--size-8); --slot-callout-cell: 8.5rem; + --slot-box-cell: 8.5rem; /* ═══ MOTION ═══ */ --motion-fast: 150ms; /* state change: hover, focus, press */ diff --git a/src/styles/components/callout.css b/src/styles/components/callout.css index 0f8eab5..04f34d5 100644 --- a/src/styles/components/callout.css +++ b/src/styles/components/callout.css @@ -1,10 +1,10 @@ -@layer components { +@layer components.blocks { .callout { @mixin my var(--space-9); counter-increment: box; display: grid; - grid-template-columns: var(--slot-callout-cell) minmax(0, 1fr); + grid-template-columns: var(--slot-box-cell) minmax(0, 1fr); border: var(--border-card) solid var(--color-border-strong); @@ -59,12 +59,6 @@ } } - .callout--example { - & .callout__kind { - background-color: var(--color-surface-elevated-3); - } - } - .callout--optional { border-width: var(--border-hairline); background-color: transparent; diff --git a/src/styles/components/index.css b/src/styles/components/index.css index 15d21e2..21d6e13 100644 --- a/src/styles/components/index.css +++ b/src/styles/components/index.css @@ -2,3 +2,4 @@ @import url("quote.css"); @import url("lead.css"); @import url("callout.css"); +@import url("reveal.css"); diff --git a/src/styles/components/lead.css b/src/styles/components/lead.css index 0cc56c7..ca1f9eb 100644 --- a/src/styles/components/lead.css +++ b/src/styles/components/lead.css @@ -1,4 +1,4 @@ -@layer components { +@layer components.blocks { .lead { --prose-line: 1lh; diff --git a/src/styles/components/prose.css b/src/styles/components/prose.css index d068975..450d1cb 100644 --- a/src/styles/components/prose.css +++ b/src/styles/components/prose.css @@ -4,7 +4,7 @@ syntax: ""; } -@layer components { +@layer components.prose { .prose { @mixin typo_body; diff --git a/src/styles/components/quote.css b/src/styles/components/quote.css index 099474c..f6b4c4b 100644 --- a/src/styles/components/quote.css +++ b/src/styles/components/quote.css @@ -1,4 +1,4 @@ -@layer components { +@layer components.blocks { .quote { @mixin my var(--space-11); @mixin py var(--space-9); diff --git a/src/styles/components/reveal.css b/src/styles/components/reveal.css new file mode 100644 index 0000000..60d5871 --- /dev/null +++ b/src/styles/components/reveal.css @@ -0,0 +1,110 @@ +@layer components.blocks { + .reveal { + @mixin my var(--space-9); + counter-increment: box; + + display: grid; + grid-template-columns: var(--slot-box-cell) minmax(0, 1fr); + + border: var(--border-card) solid var(--color-border-strong); + + background-color: var(--color-surface-elevated-1); + box-shadow: var(--shadow-card); + } + + .reveal__summary { + cursor: pointer; + + display: grid; + grid-column: 1 / -1; + grid-template-columns: subgrid; + align-items: center; + + list-style: none; + + &::-webkit-details-marker { + display: none; + } + + &:focus-visible { + @mixin focus-ring; + } + } + + .reveal__kind { + @mixin typo_label; + @mixin py var(--size-6); + @mixin px var(--size-7); + + display: flex; + flex-direction: column; + align-self: stretch; + justify-content: space-between; + + border-inline-end: var(--border-card) solid var(--color-border-strong); + + color: var(--color-text-primary); + + background-color: var(--color-surface-base); + } + + .reveal__kind::after { + content: "Box " counter(sec, upper-roman) "." counter(box); + + font-family: var(--font-mono); + font-size: var(--type--3); + font-weight: var(--font-weight-body); + color: var(--color-text-quarternary); + } + + .reveal__head { + @mixin py var(--size-6); + @mixin px var(--size-8); + + display: flex; + gap: var(--size-8); + align-items: center; + justify-content: space-between; + } + + .reveal__title { + @mixin typo_heading-4; + + font-size: var(--type-0); + } + + .reveal__action { + @mixin typo_label; + + font-size: var(--type--2); + color: var(--color-text-quiet); + white-space: nowrap; + + &::after { + content: " ⟫"; + } + } + + .reveal[open] .reveal__action { + visibility: hidden; + } + + .reveal__body { + @mixin py var(--size-6); + @mixin px var(--size-8); + + grid-column: 2; + + & > :first-child { + margin-block-start: var(--size-0); + } + + & > :last-child { + margin-block-end: var(--size-0); + } + } + + .reveal::details-content { + grid-column: 2; + } +}