Skip to content

Commit

Permalink
feat(ui): add @tailwindcss/typography for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
tszhong0411 committed Jan 31, 2025
1 parent 53b9611 commit cdc4d3b
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-fans-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tszhong0411/ui': patch
---

Add `@tailwindcss/typography` for v4
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@radix-ui/react-toggle-group": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.6",
"@radix-ui/react-visually-hidden": "^1.1.1",
"@tailwindcss/typography": "^0.5.16",
"cmdk": "^1.0.4",
"cva": "1.0.0-beta.3",
"embla-carousel-react": "^8.5.2",
Expand Down
50 changes: 50 additions & 0 deletions packages/ui/styles/typography.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@plugin '@tailwindcss/typography';

.prose {
--tw-prose-body: color-mix(in oklab, var(--color-foreground) 90%, transparent);
--tw-prose-headings: var(--color-foreground);
--tw-prose-lead: var(--color-foreground);
--tw-prose-links: var(--color-foreground);
--tw-prose-bold: var(--color-foreground);
--tw-prose-counters: var(--color-muted-foreground);
--tw-prose-bullets: var(--color-muted-foreground);
--tw-prose-hr: var(--color-border);
--tw-prose-quotes: var(--color-foreground);
--tw-prose-quote-borders: var(--color-border);
--tw-prose-captions: var(--color-foreground);
--tw-prose-th-borders: var(--color-border);
--tw-prose-td-borders: var(--color-border);
--tw-prose-code: var(--color-foreground);

& {
max-width: none;
}

:where(img):not(:where([class~='not-prose'], [class~='not-prose'] *)) {
margin: 0 auto;
}

:where(code):not(:where([class~='not-prose'], [class~='not-prose'] *)) {
padding: 2px 4px;
font-size: 13px;
border-radius: 6px;
background: color-mix(in oklab, var(--color-secondary) 50%, transparent);
border: 1px solid hsl(var(--border));

&::before,
&::after {
display: none;
}
}

:where(blockquote):not(:where([class~='not-prose'], [class~='not-prose'] *)) {
font-style: normal;

p {
&:first-of-type::before,
&:last-of-type::after {
content: none;
}
}
}
}
90 changes: 44 additions & 46 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cdc4d3b

Please sign in to comment.