Skip to content

Commit 6eb3118

Browse files
author
Dimitri POSTOLOV
authoredSep 24, 2023
[v3] rename primaryHue and primarySaturation theme options to color.hue and color.saturation (#2336)

File tree

11 files changed

+65
-88
lines changed

11 files changed

+65
-88
lines changed
 

‎.changeset/twenty-geese-return.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'nextra-theme-docs': major
3+
---
4+
5+
rename `primaryHue` and `primarySaturation` theme options to `color.hue` and `color.saturation`

‎.eslintrc.cjs

+5-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ module.exports = {
199199
files: 'examples/swr-site/**',
200200
settings: {
201201
tailwindcss: {
202-
config: 'examples/swr-site/tailwind.config.js'
202+
config: 'examples/swr-site/tailwind.config.js',
203+
cssFiles: [
204+
'examples/swr-site/styles.css',
205+
'packages/nextra-theme-docs/dist/style.css'
206+
]
203207
},
204208
next: { rootDir: 'examples/swr-site' }
205209
}

‎.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ node_modules/
55
dist/
66
.turbo/
77
out/
8-
# Theme styles
9-
packages/nextra-theme-*/style.css
108

119
# Stork related
1210
*/**/public/*.st

‎docs/pages/docs/docs-theme/theme-configuration.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ saturation values for light and dark themes.
199199
<OptionTable
200200
options={[
201201
[
202-
'primaryHue',
202+
'color.hue',
203203
'number | { dark: number; light: number }',
204204
'The hue of the primary theme color.'
205205
],
206206
[
207-
'primarySaturation',
207+
'color.saturation',
208208
'number | { dark: number; light: number }',
209209
'The saturation of the primary theme color.'
210210
]
@@ -233,7 +233,7 @@ export const hue = (
233233
)
234234
}}
235235
/>
236-
<code className="w-14 text-sm text-gray-500" />
236+
<label className="text-sm text-gray-500 w-14" />
237237
</div>
238238
)
239239

@@ -253,7 +253,7 @@ export const saturation = (
253253
)
254254
}}
255255
/>
256-
<code className="text-sm text-gray-500 w-14" />
256+
<label className="text-sm text-gray-500 w-14" />
257257
</div>
258258
)
259259

‎examples/swr-site/components/blog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function Blog() {
1717
{page.frontMatter?.description}
1818
<Link
1919
href={page.route}
20-
className="block nx-text-primary-600 underline underline-offset-2 decoration-from-font"
20+
className="block _text-primary-600 underline underline-offset-2 decoration-from-font"
2121
>
2222
Read more →
2323
</Link>

‎examples/swr-site/styles.css

-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
@tailwind utilities;
22

3-
.docs-search > span {
4-
width: 100%;
5-
}
6-
7-
.algolia-autocomplete .algolia-docsearch-suggestion--category-header span {
8-
display: inline-block;
9-
}
10-
.algolia-autocomplete .ds-dropdown-menu {
11-
width: 500px;
12-
min-width: 300px;
13-
max-width: calc(100vw - 50px);
14-
}
15-
163
.dark .invert-on-dark {
174
filter: invert(1) brightness(1.8);
185
}

‎packages/nextra-theme-docs/src/components/head.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function Head(): ReactElement {
1414
// `head` can be either FC or ReactNode. We have to directly call it if it's an
1515
// FC because hooks like Next.js' `useRouter` aren't allowed inside NextHead.
1616
const head = typeof config.head === 'function' ? config.head({}) : config.head
17-
const { primaryHue: hue, primarySaturation: saturation } = config
17+
const { hue, saturation } = config.color
1818
const { dark: darkHue, light: lightHue } =
1919
typeof hue === 'number' ? { dark: hue, light: hue } : hue
2020
const { dark: darkSaturation, light: lightSaturation } =

‎packages/nextra-theme-docs/src/constants.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export const DEFAULT_THEME: DocsThemeConfig = {
4949
</>
5050
)
5151
},
52+
color: {
53+
hue: {
54+
dark: 204,
55+
light: 212
56+
},
57+
saturation: 100
58+
},
5259
darkMode: true,
5360
direction: 'ltr',
5461
docsRepositoryBase: 'https://github.com/shuding/nextra',
@@ -120,14 +127,6 @@ export const DEFAULT_THEME: DocsThemeConfig = {
120127
content: 'Submit an issue about broken link →',
121128
labels: 'bug'
122129
},
123-
primaryHue: {
124-
dark: 204,
125-
light: 212
126-
},
127-
primarySaturation: {
128-
dark: 100,
129-
light: 100
130-
},
131130
project: {
132131
icon: (
133132
<>

‎packages/nextra-theme-docs/src/schemas.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,20 @@ export const themeSchema = /* @__PURE__ */ (() =>
100100
content: z.custom<ReactNode | FC>(...reactNode),
101101
labels: z.string()
102102
}),
103-
primaryHue: z.number().or(
104-
z.strictObject({
105-
dark: z.number(),
106-
light: z.number()
107-
})
108-
),
109-
primarySaturation: z.number().or(
110-
z.strictObject({
111-
dark: z.number(),
112-
light: z.number()
113-
})
114-
),
103+
color: z.strictObject({
104+
hue: z.number().or(
105+
z.strictObject({
106+
dark: z.number(),
107+
light: z.number()
108+
})
109+
),
110+
saturation: z.number().or(
111+
z.strictObject({
112+
dark: z.number(),
113+
light: z.number()
114+
})
115+
)
116+
}),
115117
project: z.strictObject({
116118
icon: z.custom<ReactNode | FC>(...reactNode),
117119
link: z.string().startsWith('https://').optional()

‎packages/nextra/src/server/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ const nextra: Nextra = nextraConfig => {
9797
}
9898
}
9999

100+
// Fixes https://github.com/vercel/next.js/issues/55872
101+
if (config.watchOptions.ignored instanceof RegExp) {
102+
const ignored = config.watchOptions.ignored.source
103+
104+
config.watchOptions = {
105+
...config.watchOptions,
106+
ignored: new RegExp(
107+
ignored.replace('(\\.(git|next)|node_modules)', '\\.(git|next)')
108+
)
109+
}
110+
}
111+
100112
const defaultESMAppPath = require.resolve('next/dist/esm/pages/_app.js')
101113
const defaultCJSAppPath = require.resolve('next/dist/pages/_app.js')
102114

‎pnpm-lock.yaml

+16-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.