Skip to content

Commit e82ba18

Browse files
committed
This PR is for UI enhancements/migration-reference(tailwind v3-v4) purpose only.
1 parent a1bfd3e commit e82ba18

35 files changed

+1082
-1060
lines changed

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"singleQuote": true,
3-
"semi": false
3+
"semi": false,
4+
"plugins": ["prettier-plugin-tailwindcss"]
45
}

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"dev:backend": "convex dev --tail-logs",
1313
"build": "vite build",
1414
"start": "vite start",
15-
"lint": "prettier --check '**/*' --ignore-unknown && eslint --ext .ts,.tsx ./src",
16-
"format": "prettier --write '**/*' --ignore-unknown",
15+
"lint": "prettier --check --ignore-unknown * && eslint --ext .ts,.tsx ./src",
16+
"format": "prettier --write --ignore-unknown *",
1717
"linkAll": "node scripts/link.js"
1818
},
1919
"dependencies": {
@@ -81,17 +81,18 @@
8181
"@content-collections/core": "^0.8.2",
8282
"@content-collections/vite": "^0.2.4",
8383
"@shikijs/transformers": "^1.10.3",
84+
"@tailwindcss/postcss": "^4.1.8",
8485
"@types/react": "^18.3.12",
8586
"@types/react-dom": "^18.3.1",
8687
"@types/remove-markdown": "^0.3.4",
87-
"autoprefixer": "^10.4.18",
8888
"dotenv-cli": "^8.0.0",
8989
"eslint": "^8.57.0",
9090
"eslint-plugin-unicorn": "^49.0.0",
9191
"npm-run-all": "^4.1.5",
92-
"postcss": "^8.4.35",
93-
"prettier": "^2.8.8",
94-
"tailwindcss": "^3.4.1",
92+
"postcss": "^8.5.4",
93+
"prettier": "^3.5.3",
94+
"prettier-plugin-tailwindcss": "^0.6.12",
95+
"tailwindcss": "^4.1.8",
9596
"typescript": "^5.6.3",
9697
"vite": "^6.3.5"
9798
},

pnpm-lock.yaml

Lines changed: 439 additions & 329 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postcss.config.cjs

Lines changed: 0 additions & 7 deletions
This file was deleted.

postcss.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
plugins: {
3+
'@tailwindcss/postcss': {},
4+
},
5+
}

src/components/Doc.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import * as React from 'react'
2-
import { FaEdit } from 'react-icons/fa'
3-
import { marked } from 'marked'
4-
import markedAlert from 'marked-alert'
5-
import { gfmHeadingId, getHeadingList } from 'marked-gfm-heading-id'
61
import { DocTitle } from '~/components/DocTitle'
72
import { Markdown } from '~/components/Markdown'
8-
import { Toc } from './Toc'
3+
import { marked } from 'marked'
4+
import markedAlert from 'marked-alert'
5+
import { getHeadingList, gfmHeadingId } from 'marked-gfm-heading-id'
6+
import * as React from 'react'
7+
import { FaEdit } from 'react-icons/fa'
98
import { twMerge } from 'tailwind-merge'
10-
import { TocMobile } from './TocMobile'
119
import { GadLeader } from './GoogleScripts'
10+
import { Toc } from './Toc'
11+
import { TocMobile } from './TocMobile'
1212

1313
type DocProps = {
14+
isBlog?: boolean
1415
title: string
1516
content: string
1617
repo: string
@@ -22,6 +23,7 @@ type DocProps = {
2223
}
2324

2425
export function Doc({
26+
isBlog = false,
2527
title,
2628
content,
2729
repo,
@@ -35,7 +37,7 @@ export function Doc({
3537
const markup = marked.use(
3638
{ gfm: true },
3739
gfmHeadingId(),
38-
markedAlert()
40+
markedAlert(),
3941
)(content) as string
4042

4143
const headings = getHeadingList()
@@ -59,7 +61,7 @@ export function Doc({
5961
map[headingElement.target.id] = headingElement
6062
return map
6163
},
62-
headingElementRefs.current
64+
headingElementRefs.current,
6365
)
6466

6567
const visibleHeadings: Array<IntersectionObserverEntry> = []
@@ -82,8 +84,8 @@ export function Doc({
8284

8385
const headingElements = Array.from(
8486
markdownContainerRef.current?.querySelectorAll(
85-
'h2[id], h3[id], h4[id], h5[id], h6[id]'
86-
) ?? []
87+
'h2[id], h3[id], h4[id], h5[id], h6[id]',
88+
) ?? [],
8789
)
8890
headingElements.forEach((el) => observer.observe(el))
8991

@@ -95,34 +97,34 @@ export function Doc({
9597
{shouldRenderToc ? <TocMobile headings={headings} /> : null}
9698
<div
9799
className={twMerge(
98-
'w-full flex bg-white/70 dark:bg-black/40 mx-auto rounded-xl max-w-[936px]',
100+
'mx-auto flex w-full bg-white/70 dark:bg-black/40',
99101
isTocVisible && 'max-w-full',
100-
shouldRenderToc && 'lg:pt-0'
102+
shouldRenderToc && 'lg:pt-0',
101103
)}
102104
>
103105
<div
104106
className={twMerge(
105-
'flex overflow-auto flex-col w-full p-4 lg:p-6',
106-
isTocVisible && '!pr-0'
107+
'ml-auto flex w-full max-w-[820px] flex-col overflow-auto p-4.5',
108+
isBlog && 'mx-auto',
107109
)}
108110
>
109111
<GadLeader />
110112
{title ? <DocTitle>{title}</DocTitle> : null}
111113
<div className="h-4" />
112-
<div className="h-px bg-gray-500 opacity-20" />
114+
<div className="h-px bg-gray-500/20" />
113115
<div className="h-4" />
114116
<div
115117
ref={markdownContainerRef}
116118
className={twMerge(
117119
'prose prose-gray prose-sm prose-p:leading-7 dark:prose-invert max-w-none',
118120
isTocVisible && 'pr-4 lg:pr-6',
119-
'styled-markdown-content'
121+
'styled-markdown-content',
120122
)}
121123
>
122124
<Markdown htmlMarkup={markup} />
123125
</div>
124126
<div className="h-12" />
125-
<div className="w-full h-px bg-gray-500 opacity-30" />
127+
<div className="h-px w-full bg-gray-500 opacity-30" />
126128
<div className="py-4 opacity-70">
127129
<a
128130
href={`https://github.com/${repo}/edit/${branch}/${filePath}`}
@@ -134,15 +136,22 @@ export function Doc({
134136
<div className="h-24" />
135137
</div>
136138

137-
{isTocVisible && (
138-
<div className="border-l border-gray-500/20 max-w-52 w-full hidden 2xl:block transition-all">
139+
{isTocVisible ? (
140+
<div className="hidden w-full max-w-64 border-l border-gray-500/20 transition-all 2xl:block">
139141
<Toc
140142
headings={headings}
141143
activeHeadings={activeHeadings}
142144
colorFrom={colorFrom}
143145
colorTo={colorTo}
144146
/>
145147
</div>
148+
) : (
149+
<div
150+
className={twMerge(
151+
'hidden w-full max-w-64 2xl:block',
152+
isBlog && '2xl:hidden',
153+
)}
154+
/>
146155
)}
147156
</div>
148157
</React.Fragment>

src/components/DocContainer.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ export function DocContainer({
88
return (
99
<div
1010
{...props}
11-
className={twMerge(
12-
'w-full max-w-full p-2 md:p-4 2xl:p-8',
13-
props.className
14-
)}
11+
className={twMerge('w-full max-w-full lg:pr-4', props.className)}
1512
>
1613
{children}
1714
</div>

0 commit comments

Comments
 (0)