Skip to content

Commit

Permalink
website: fix type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 17, 2022
1 parent 3a566f2 commit 15b2bee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"prepare": "husky install",
"version": "lerna version --exact --force-publish --no-push --no-git-tag-version",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,json}'",
"remove": "npm run clean && lerna exec \"rm -rf package-lock.json\" --scope react-code-preview-layout --scope website",
"remove": "npm run clean && lerna exec \"rm -rf package-lock.json\" --scope @uiw/* --scope website",
"clean": "lerna clean --yes"
},
"workspaces": [
Expand Down
8 changes: 4 additions & 4 deletions www/src/pages/extensions/themes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ const ToolsWapper = styled.div`

export const ThemesAllDoc = () => {
const dark = document.documentElement.getAttribute('data-color-mode');
const [selectTheme, setSelectTheme] = useState<keyof typeof themes>();
const { vscodeDarkInit, ...themesAll } = themes;
const [selectTheme, setSelectTheme] = useState<keyof typeof themesAll>();
const [theme, setTheme] = useState<ReactCodeMirrorProps['theme']>(dark === 'dark' ? 'dark' : 'light');
useEffect(() => {
setTheme(document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light');
document.addEventListener('colorschemechange', (e) => {
setTheme(e.detail.colorScheme as ReactCodeMirrorProps['theme']);
});
}, []);

const themeCurrent = themes[selectTheme!] ? themes[selectTheme!] : theme;
const themeCurrent = themesAll[selectTheme!] ? themesAll[selectTheme!] : theme;
const changeHandle = (ev: React.ChangeEvent<HTMLSelectElement>) => {
setSelectTheme(ev.target.value as keyof typeof themes);
setSelectTheme(ev.target.value as keyof typeof themesAll);
};
return (
<PageWarpper>
Expand Down

0 comments on commit 15b2bee

Please sign in to comment.