From a8000d326ade47b70d0b06388aa13ef764f555ff Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Sat, 16 Mar 2024 03:06:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=92=84=20style:=20Update=20Markdown?= =?UTF-8?q?=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NativeSelect/SelectItem/index.tsx | 8 ++++---- src/layouts/DocLayout/index.tsx | 2 -- src/slots/Content/index.tsx | 8 ++++---- src/slots/Content/style.ts | 15 +++++++++++++++ src/slots/Features/index.tsx | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/components/NativeSelect/SelectItem/index.tsx b/src/components/NativeSelect/SelectItem/index.tsx index ea309aa..bb4ff6c 100644 --- a/src/components/NativeSelect/SelectItem/index.tsx +++ b/src/components/NativeSelect/SelectItem/index.tsx @@ -1,4 +1,4 @@ -import { ForwardedRef, forwardRef, memo } from 'react'; +import { ForwardedRef, forwardRef } from 'react'; import { useStyles } from './style'; @@ -12,8 +12,8 @@ interface SelectItemProps { value: any; } -const SelectItem = memo( - forwardRef(({ value, label, prefixCls, isSelected, isActive, disabled, ...props }, reference) => { +const SelectItem = forwardRef( + ({ value, label, prefixCls, isSelected, isActive, disabled, ...props }, reference) => { const { styles, cx } = useStyles(prefixCls); return ( @@ -34,7 +34,7 @@ const SelectItem = memo( {label} ); - }), + }, ); export default SelectItem; diff --git a/src/layouts/DocLayout/index.tsx b/src/layouts/DocLayout/index.tsx index 3ef3a90..20a5c28 100644 --- a/src/layouts/DocLayout/index.tsx +++ b/src/layouts/DocLayout/index.tsx @@ -28,5 +28,3 @@ const App = memo(() => { ); }); - -export default App; diff --git a/src/slots/Content/index.tsx b/src/slots/Content/index.tsx index 32e9925..42ce0bb 100644 --- a/src/slots/Content/index.tsx +++ b/src/slots/Content/index.tsx @@ -1,3 +1,4 @@ +import { Typography } from '@lobehub/ui'; import { Skeleton } from 'antd'; import { useResponsive } from 'antd-style'; import isEqual from 'fast-deep-equal'; @@ -22,16 +23,15 @@ const Content = memo(({ children, ...props }) => { return ( -
- -
+ {children} -
+
diff --git a/src/slots/Content/style.ts b/src/slots/Content/style.ts index d0f00ab..5d4cbdf 100644 --- a/src/slots/Content/style.ts +++ b/src/slots/Content/style.ts @@ -78,6 +78,21 @@ export const useStyles = createStyles( padding-inline-start: 18px; } } + + summary kbd { + transform: unset; + + padding: unset; + + font-size: inherit; + line-height: inherit; + color: inherit; + + background: unset; + border: unset; + box-shadow: unset; + } + } `, ), }), diff --git a/src/slots/Features/index.tsx b/src/slots/Features/index.tsx index 609e526..8b636b0 100644 --- a/src/slots/Features/index.tsx +++ b/src/slots/Features/index.tsx @@ -11,7 +11,7 @@ const Features = memo(() => { if (!features?.length) return; - return ; + return ; }); export default Features; From 807ec0c8bfea157d9c3a902aec7210ffc111e91d Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Mon, 17 Jun 2024 22:32:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Lock=20dumi=20to=202.?= =?UTF-8?q?2.17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 87 +++++++++++++++++++------------------- src/slots/Navbar/index.tsx | 9 +++- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 3747897..c1c8482 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dumi-theme-lobehub", - "version": "1.7.7", + "version": "1.5.0", "description": "dumi-theme-lobehub is a documentation site theme package designed for dumi2. It provides a more beautiful and user-friendly development and reading experience based on @lobehub/ui", "keywords": [ "lobehub", @@ -69,52 +69,51 @@ ] }, "dependencies": { - "@floating-ui/react": "^0", - "@giscus/react": "^2", - "@lobehub/ui": "^1", - "ahooks": "^3", - "antd": "^5", - "antd-style": "^3", - "chalk": "^4", - "fast-deep-equal": "^3", - "history": "^5", - "lodash-es": "^4", - "lucide-react": "latest", - "polished": "^4", - "rc-footer": "^0", - "react-layout-kit": "^1", - "styled-components": "latest", - "use-merge-value": "^1", - "zustand": "^4" + "@floating-ui/react": "^0.26.17", + "@giscus/react": "^2.4.0", + "@lobehub/ui": "^1.142.4", + "ahooks": "^3.8.0", + "antd": "^5.18.2", + "antd-style": "^3.6.2", + "chalk": "^4.1.2", + "fast-deep-equal": "^3.1.3", + "history": "^5.3.0", + "lodash-es": "^4.17.21", + "lucide-react": "^0.395.0", + "polished": "^4.3.1", + "rc-footer": "^0.6.8", + "react-layout-kit": "^1.9.0", + "use-merge-value": "^1.2.0", + "zustand": "^4.5.2" }, "devDependencies": { "@commitlint/cli": "^19.0.0", - "@lobehub/lint": "latest", - "@types/lodash-es": "^4", - "@types/node": "^20", - "@types/react": "18.2.40", - "@types/react-dom": "^18", - "@vitest/coverage-v8": "latest", - "clean-pkg-json": "^1", - "commitlint": "^19.0.0", - "dumi": "^2", - "dumi-assets-types": "^1", - "eslint": "^8", - "father": "4.3.1", - "father-plugin-dumi-theme": "latest", - "husky": "^9.0.0", - "jsdom": "^24.0.0", - "leva": "^0", - "lint-staged": "^15.0.0", - "prettier": "^3", - "react": "^18", - "react-dom": "^18", - "remark": "^14", - "remark-cli": "^11", - "semantic-release": "^21", - "stylelint": "^16.0.0", - "typescript": "^5", - "vitest": "latest" + "@lobehub/lint": "^1.23.4", + "@types/lodash-es": "^4.17.12", + "@types/node": "^20.14.2", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@vitest/coverage-v8": "^1.6.0", + "clean-pkg-json": "^1.2.0", + "commitlint": "^17.8.1", + "dumi": "2.2.17", + "dumi-assets-types": "^1.0.1", + "eslint": "^8.57.0", + "father": "^4.4.4", + "father-plugin-dumi-theme": "1.0.0-rc.1", + "husky": "^8.0.3", + "jsdom": "^22.1.0", + "leva": "^0.9.35", + "lint-staged": "^13.3.0", + "prettier": "^3.3.2", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "remark": "^14.0.3", + "remark-cli": "^11.0.0", + "semantic-release": "^21.1.2", + "stylelint": "^15.11.0", + "typescript": "^5.4.5", + "vitest": "^1.6.0" }, "peerDependencies": { "antd": ">=5", diff --git a/src/slots/Navbar/index.tsx b/src/slots/Navbar/index.tsx index 43a35d5..c227901 100644 --- a/src/slots/Navbar/index.tsx +++ b/src/slots/Navbar/index.tsx @@ -1,6 +1,6 @@ import { TabsNav } from '@lobehub/ui'; import { createStyles } from 'antd-style'; -import { Link } from 'dumi'; +import { Link, history } from 'dumi'; import NavbarExtra from 'dumi/theme-default/slots/NavbarExtra'; import { memo } from 'react'; import { shallow } from 'zustand/shallow'; @@ -45,6 +45,13 @@ const Navbar = memo(() => { ), }))} + onChange={(path) => { + const url = nav.find((index) => index.activePath === path || index.link === path)?.link; + + if (!url) return; + + history.push(url); + }} /> From 46108db6a06b031516991f951cb8476c3ef730fd Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Mon, 17 Jun 2024 22:57:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ApiHeader/index.tsx | 12 +-- src/layouts/DocLayout/index.tsx | 2 + src/slots/Content/style.ts | 114 ++++++----------------------- 3 files changed, 26 insertions(+), 102 deletions(-) diff --git a/src/components/ApiHeader/index.tsx b/src/components/ApiHeader/index.tsx index 5ddfab9..6bc446e 100644 --- a/src/components/ApiHeader/index.tsx +++ b/src/components/ApiHeader/index.tsx @@ -1,4 +1,4 @@ -import { Icon, Snippet } from '@lobehub/ui'; +import { Icon, Markdown, Snippet } from '@lobehub/ui'; import { Divider, Space, Typography } from 'antd'; import { useResponsive } from 'antd-style'; import { Edit3, Github } from 'lucide-react'; @@ -106,15 +106,9 @@ export const ApiHeader = memo( : `import { ${componentName} } from '${pkg}';`; return ( - + {title} - {description && ( -
- - {description} - -
- )} + {description && {description}} {!isDoc && ( {componentName && ( diff --git a/src/layouts/DocLayout/index.tsx b/src/layouts/DocLayout/index.tsx index 20a5c28..3ef3a90 100644 --- a/src/layouts/DocLayout/index.tsx +++ b/src/layouts/DocLayout/index.tsx @@ -28,3 +28,5 @@ const App = memo(() => { ); }); + +export default App; diff --git a/src/slots/Content/style.ts b/src/slots/Content/style.ts index 5d4cbdf..d24b754 100644 --- a/src/slots/Content/style.ts +++ b/src/slots/Content/style.ts @@ -1,99 +1,27 @@ import { createStyles } from 'antd-style'; -export const useStyles = createStyles( - ({ cx, token, responsive, css, stylish }, isPure: boolean) => ({ - content: cx( - !isPure && - css` - padding: 24px 48px; - background-color: ${token.colorBgContainer}; - border-radius: 10px; - - ${responsive.mobile} { - padding: 8px 16px; - border-radius: 0; - } - `, +export const useStyles = createStyles(({ cx, token, responsive, css }, isPure: boolean) => ({ + content: cx( + !isPure && css` - flex: 1; - box-sizing: border-box; - width: 100%; - min-height: 400px; + padding: 24px 48px; + background-color: ${token.colorBgContainer}; + border-radius: 10px; - &:has([data-page-tabs='true']) { - padding-top: 8px; + ${responsive.mobile} { + padding: 8px 16px; + border-radius: 0; } - - .markdown { - ${stylish.markdown}; - h2, - h3 { - &[id^='version'] { - color: ${token.colorText}; - } - } - - h1, - h2, - h3, - h4, - h5, - h6 { - transition: all 400ms ${token.motionEaseOut}; - - > a[aria-hidden]:first-child { - float: left; - - width: 20px; - margin-inline-start: -24px; - padding-inline-end: 4px; - - font-size: inherit; - line-height: inherit; - color: ${token.colorText}; - text-align: right; - - &:hover { - border: 0; - } - - > .icon-link::before { - content: '#'; - font-size: inherit; - color: ${token.colorTextTertiary}; - } - } - - &:hover { - color: ${token.colorText}; - } - - &:not(:hover) > a[aria-hidden]:first-child > .icon-link { - visibility: hidden; - } - } - - ol, - ul { - padding-inline-start: 18px; - } - } - - summary kbd { - transform: unset; - - padding: unset; - - font-size: inherit; - line-height: inherit; - color: inherit; - - background: unset; - border: unset; - box-shadow: unset; - } - } `, - ), - }), -); + css` + flex: 1; + box-sizing: border-box; + width: 100%; + min-height: 400px; + + &:has([data-page-tabs='true']) { + padding-top: 8px; + } + `, + ), +}));