Files
Danny White 9bd86bee93 feat(design-system): document shared inline code defaults (#51984)
## Problem

The design system repeats inline-code styles and does not document the
new shared defaults.

## Solution

Import the shared styles from #51980 and document how sizing, colour,
weight and wrapping work. Add examples of bare and linked code, tables,
long values, Tailwind overrides and `data-code-style="plain"`. Remove
repeated styles from existing examples.

Highlighted code blocks keep an explicit `text-sm` size so removing
inline-code classes does not enlarge them.

## Review instructions

This PR changes the design-system app only.

1. Open the [Layout
page](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/layout).
Check the inline-code examples at narrow and desktop widths in both
themes.
2. Check code in headings, long values, explicit size overrides and the
plain display example. Code should use the default foreground colour and
follow the surrounding weight unless a class overrides it.
3. Check the [chart palette
example](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/charts).
CSS variable names should remain `<code>` elements with their own
display styles.

| Before | After |
| --- | --- |
| <img width="1666" height="770" alt="CleanShot 2026-10-20 at 16 37
20@2x"
src="https://github.com/user-attachments/assets/2ac87442-12a9-49ab-8e4f-f82436308567"
/> | <img width="1680" height="782" alt="CleanShot 2026-10-20 at 16 36
12@2x"
src="https://github.com/user-attachments/assets/b0074844-3431-4fb9-827b-c6fd0de889fe"
/> |
| _Layout
([live](https://supabase.com/design-system/docs/ui-patterns/layout))_ |
_Layout
([preview](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/layout))_
|
| <img width="1072" height="476" alt="CleanShot 2026-10-20 at 16 35
14@2x"
src="https://github.com/user-attachments/assets/242bf850-58fa-4b29-a978-bd0e296c2e8b"
/> | <img width="1072" height="484" alt="CleanShot 2026-10-20 at 16 34
47@2x"
src="https://github.com/user-attachments/assets/962adef0-05b7-47ed-8fdc-5229a3a332e1"
/> |
| _Charts
([live](https://supabase.com/design-system/docs/ui-patterns/charts))_ |
_Charts
([preview](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/charts)):
no visual changes as `data-code-style="plain"` has been used_ |
2026-10-22 00:48:57 +00:00

93 lines
2.0 KiB
CSS

@reference './globals.css';
/* [data-theme="light"] {
display: block;
} */
/* [data-theme="dark"] {
display: none;
} */
.dark [data-theme='light'] {
display: none;
}
.dark [data-theme='dark'] {
display: block;
}
[data-rehype-pretty-code-figure] {
@apply relative;
}
[data-rehype-pretty-code-figure] code {
@apply font-mono text-sm grid min-w-full break-words rounded-none border-0 bg-transparent p-0;
counter-reset: line;
box-decoration-break: clone;
}
[data-rehype-pretty-code-figure] [data-line] {
@apply px-4 min-h-[1rem] py-0.5 w-full inline-block;
}
[data-rehype-pretty-code-figure] [data-line-numbers] [data-line] {
@apply px-2;
}
[data-rehype-pretty-code-figure] [data-line-numbers] > [data-line]::before {
@apply text-foreground-muted text-xs;
counter-increment: line;
content: counter(line);
display: inline-block;
width: 1.8rem;
margin-right: 1.4rem;
text-align: right;
}
[data-rehype-pretty-code-figure] .line--highlighted {
@apply relative bg-surface-200 dark:bg-surface-100;
}
[data-rehype-pretty-code-figure] .line--highlighted {
@apply border-foreground-muted border-l-2;
}
[data-rehype-pretty-code-figure] .line-highlighted span {
@apply relative;
}
/* reset <mark> default text color */
[data-rehype-pretty-code-figure] .word--highlighted {
@apply rounded-md bg-zinc-700/50 border-zinc-700/70 p-1 text-inherit;
}
.dark [data-rehype-pretty-code-figure] .word--highlighted {
@apply bg-zinc-900;
}
[data-rehype-pretty-code-title] {
@apply mt-2 pt-6 px-4 text-sm font-medium;
}
[data-rehype-pretty-code-title] + pre {
@apply mt-2;
}
.mdx > .steps:first-child > h3:first-child {
@apply mt-0;
}
.steps > h3 {
@apply mt-8 mb-4 text-base font-semibold;
}
/* .preview-grid-background {
position: absolute;
inset: 0;
height: 100%;
width: 100%;
background-image: linear-gradient(to right, #80808012 1px, transparent 1px),
linear-gradient(to bottom, #80808012 1px, transparent 1px);
background-size: 24px 24px;
} */