Skip to content

Commit 54a6882

Browse files
committed
website: update router link. #409
1 parent f8f65af commit 54a6882

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

themes/gruvbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@uiw/codemirror-theme-gruvbox-dark",
33
"version": "4.20.3",
44
"description": "Theme gruvbox-dark for CodeMirror.",
5-
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/gruvbox-dark",
5+
"homepage": "https://uiwjs.github.io/react-codemirror/#/theme/data/gruvbox/dark",
66
"author": "kenny wong <wowohoo@qq.com>",
77
"license": "MIT",
88
"main": "./cjs/index.js",

www/src/pages/theme/Preview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ export const Preview: FC<PropsWithChildren<PreviewProps>> = (props) => {
5656
const { mdData } = useMdData(props.path);
5757
const childs = Children.toArray(props.children);
5858
const [previewDoc, setPreviewDoc] = useState(false);
59-
const themeName = themePkg?.replace('@uiw/codemirror-theme-', '').replace('-', ' ');
60-
const themeExtensionName = themePkg?.replace('@uiw/codemirror-theme-', '') + (!!mode ? `-${mode}` : '');
59+
const themePkgNmae = !!mode ? themePkg?.replace(/-(light|dark)$/, '') : themePkg;
60+
const themeName = themePkgNmae?.replace('@uiw/codemirror-theme-', '').replace('-', ' ');
61+
const themeExtensionName = themePkgNmae?.replace('@uiw/codemirror-theme-', '') + (!!mode ? `-${mode}` : '');
6162
const extension = themeData[toCamelCase(themeExtensionName) as keyof typeof themeData];
6263
return (
6364
<Warpper>

www/src/pages/theme/home/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export function ThemesHome() {
7474
<Warpper>
7575
<ThemesWarpper>
7676
{Object.keys(themeData).map((name, idx) => {
77-
const linkName = (toSnakeCase(name) || []).join('/');
77+
const linkName = (toSnakeCase(name) || [])
78+
.join('-')
79+
.replace(/-light$/, '/light')
80+
.replace(/-dark$/, '/dark');
7881
return (
7982
<Link key={idx} to={`/theme/data/${linkName}`}>
8083
<ThemeCard>

www/src/router.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ export const routes: MenuRouteObject[] = [
317317
/>
318318
),
319319
},
320+
{
321+
path: 'data/gruvbox-dark',
322+
element: <Navigate to="/theme/data/gruvbox/dark" replace />,
323+
},
320324
{
321325
path: 'data/gruvbox/dark',
322326
label: 'Gruvbox Dark',
@@ -362,7 +366,7 @@ export const routes: MenuRouteObject[] = [
362366
),
363367
},
364368
{
365-
path: 'data/noctis/lilac',
369+
path: 'data/noctis-lilac',
366370
label: 'noctis lilac',
367371
element: (
368372
<Preview
@@ -424,7 +428,7 @@ export const routes: MenuRouteObject[] = [
424428
),
425429
},
426430
{
427-
path: 'data/tokyo/night',
431+
path: 'data/tokyo-night',
428432
label: 'tokyo night',
429433
element: (
430434
<Preview
@@ -434,7 +438,7 @@ export const routes: MenuRouteObject[] = [
434438
),
435439
},
436440
{
437-
path: 'data/tokyo/night/storm',
441+
path: 'data/tokyo-night-storm',
438442
label: 'tokyo night storm',
439443
element: (
440444
<Preview
@@ -444,7 +448,7 @@ export const routes: MenuRouteObject[] = [
444448
),
445449
},
446450
{
447-
path: 'data/tokyo/night/day',
451+
path: 'data/tokyo-night-day',
448452
label: 'tokyo night day',
449453
element: (
450454
<Preview
@@ -453,6 +457,10 @@ export const routes: MenuRouteObject[] = [
453457
/>
454458
),
455459
},
460+
{
461+
path: 'data/vscode',
462+
element: <Navigate to="dark" replace />,
463+
},
456464
{
457465
path: 'data/vscode/dark',
458466
label: 'VS Code',

0 commit comments

Comments
 (0)