Skip to content

Commit 4fb582d

Browse files
committedAug 28, 2023
website: modify theme document & add badges.
1 parent 7bbdf82 commit 4fb582d

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed
 

‎package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@
2525
"node": ">=16.0.0"
2626
},
2727
"devDependencies": {
28-
"@kkt/ncc": "^1.0.13",
2928
"@kkt/less-modules": "^7.2.0",
29+
"@kkt/ncc": "^1.0.13",
3030
"@types/react-test-renderer": "~18.0.0",
3131
"husky": "~8.0.0",
32+
"jest": "^29.5.0",
33+
"jest-environment-jsdom": "^29.5.0",
34+
"jest-environment-node": "^29.5.0",
35+
"jest-watch-typeahead": "^2.2.2",
3236
"kkt": "^7.2.0",
3337
"lerna": "^7.0.0",
3438
"lint-staged": "^14.0.1",
3539
"prettier": "^3.0.2",
3640
"react-test-renderer": "~18.2.0",
37-
"tsbb": "^4.1.5",
38-
"jest": "^29.5.0",
39-
"jest-watch-typeahead": "^2.2.2",
40-
"jest-environment-jsdom": "^29.5.0",
41-
"jest-environment-node": "^29.5.0"
41+
"tsbb": "^4.1.5"
4242
}
4343
}

‎www/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
"@uiw/react-codemirror": "4.21.11",
8282
"@uiw/react-github-corners": "~1.5.14",
8383
"@uiw/react-markdown-preview": "^4.1.13",
84-
"@uiw/react-shields": "~1.1.3",
85-
"@uiw/reset.css": "~1.0.5",
84+
"@uiw/react-shields": "^1.3.2",
8685
"@wcj/dark-mode": "~1.0.12",
8786
"code-example": "^3.3.6",
8887
"markdown-react-code-preview-loader": "^2.1.2",

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33
import styled, { keyframes } from 'styled-components';
44
import GitHubCorners from '@uiw/react-github-corners';
5-
import Github from '@uiw/react-shields/esm/github';
6-
import Npm from '@uiw/react-shields/esm/npm';
5+
import Github from '@uiw/react-shields/github';
6+
import Npm from '@uiw/react-shields/npm';
77
import BackToUp from '@uiw/react-back-to-top';
88
import logo from '../../logo.png';
99
import Example from './Example';
@@ -71,8 +71,13 @@ const Buttons = styled.div`
7171
&:hover {
7272
background-color: var(--color-fg-muted);
7373
color: var(--color-theme-bg);
74-
transition: background-color 0.25s linear, color 0.05s linear, opacity 0.25s linear, filter 0.25s linear,
75-
visibility 0.25s linear, transform 0.25s linear;
74+
transition:
75+
background-color 0.25s linear,
76+
color 0.05s linear,
77+
opacity 0.25s linear,
78+
filter 0.25s linear,
79+
visibility 0.25s linear,
80+
transform 0.25s linear;
7681
}
7782
&:last-child {
7883
color: var(--color-prettylights-syntax-keyword);
@@ -91,7 +96,9 @@ const Footer = styled.div`
9196

9297
const AppHeader = styled.div`
9398
background-color: var(--color-canvas-subtle);
94-
box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1), 0 1px rgba(0, 0, 0, 0.1);
99+
box-shadow:
100+
0px 2px 10px 0px rgba(0, 0, 0, 0.1),
101+
0 1px rgba(0, 0, 0, 0.1);
95102
padding: 120px 20px 40px 20px;
96103
border-bottom: 1px solid var(--color-canvas-default);
97104
position: relative;

‎www/src/pages/theme/Preview.tsx

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { FC, Children, PropsWithChildren, cloneElement, useState } from 'react';
22
import styled from 'styled-components';
3+
import Npm from '@uiw/react-shields/npm';
34
import { useMdData } from '../../components/useMdData';
45
import { Warpper } from '../../components/Warpper';
56
import { PreCode } from './themes/PreCode';
@@ -19,10 +20,7 @@ export const Content = styled.div`
1920
flex: 1;
2021
`;
2122

22-
export const Button = styled.button`
23-
position: absolute;
24-
right: 0;
25-
`;
23+
export const Button = styled.button``;
2624

2725
export const Title = styled.div`
2826
font-size: 24px;
@@ -52,6 +50,13 @@ export const Header = styled.div`
5250
}
5351
`;
5452

53+
const ButtonGroup = styled.div`
54+
float: right;
55+
display: flex;
56+
align-items: center;
57+
gap: 10px;
58+
`;
59+
5560
export const Preview: FC<PropsWithChildren<PreviewProps>> = (props) => {
5661
const { themePkg, mode } = props;
5762
const { mdData } = useMdData(props.path);
@@ -61,17 +66,28 @@ export const Preview: FC<PropsWithChildren<PreviewProps>> = (props) => {
6166
const themeName = themePkgNmae?.replace('@uiw/codemirror-theme-', '').replace('-', ' ');
6267
const themeExtensionName = themePkgNmae?.replace('@uiw/codemirror-theme-', '') + (!!mode ? `-${mode}` : '');
6368
const extension = themeData[toCamelCase(themeExtensionName) as keyof typeof themeData];
69+
const repoName = themePkgNmae?.replace(/@uiw\//, '');
6470
return (
6571
<Warpper>
6672
<Content>
6773
{props.themePkg && (
6874
<Header>
6975
<Title>{themeName} Theme</Title>
70-
<div>
76+
<ButtonGroup>
77+
<Npm.Downloads
78+
scope="@uiw"
79+
packageName={repoName}
80+
href={`https://www.npmjs.com/package/@uiw/${repoName}`}
81+
/>
82+
<Npm.Version
83+
scope="@uiw"
84+
packageName={repoName}
85+
href={`https://www.npmjs.com/package/@uiw/${repoName}`}
86+
/>
7187
<Button onClick={() => setPreviewDoc(previewDoc === 'document' ? 'example' : 'document')}>
7288
{previewDoc === 'document' ? 'Preview Theme Example' : 'Preview Document'}
7389
</Button>
74-
</div>
90+
</ButtonGroup>
7591
<PreCode value={`npm install ${themePkg} --save`} />
7692
</Header>
7793
)}

0 commit comments

Comments
 (0)
Please sign in to comment.