From 4f957e7e92355696b7b5d2841dc66932b181a40d Mon Sep 17 00:00:00 2001 From: kazoottt Date: Sun, 4 Feb 2024 16:56:45 +0800 Subject: [PATCH 1/4] feat: highlight the selected tag --- themes/heo/components/TagGroups.js | 46 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index 7c8ae0e6..a74a43b3 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -1,4 +1,5 @@ import Link from 'next/link' +import { useRouter } from 'next/router' /** * 标签组 @@ -9,22 +10,37 @@ import Link from 'next/link' */ const TagGroups = ({ tags, className }) => { if (!tags) return <> - return ( -
- { - tags.map((tag, index) => { - return -
-
{tag.name}
{tag.count ? {tag.count} : <>} -
- - }) - } -
+ const router = useRouter() + const { tag: currentTag } = router.query + + return ( +
+ {tags.map((tag, index) => { + const selected = currentTag === tag.name + return ( + +
+
{tag.name}
+ {tag.count ? ( + {tag.count} + ) : ( + <> + )} +
+ + ) + })} +
) } From e1a2ead2be7c3a0821aace530bd1ea0bf5cd9037 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 17:52:43 +0800 Subject: [PATCH 2/4] check --- themes/heo/components/TagGroups.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index a74a43b3..5087ad5f 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -9,10 +9,9 @@ import { useRouter } from 'next/router' * @constructor */ const TagGroups = ({ tags, className }) => { - if (!tags) return <> - const router = useRouter() const { tag: currentTag } = router.query + if (!tags) return <> return (
@@ -31,11 +30,13 @@ const TagGroups = ({ tags, className }) => { flex items-center hover:bg-blue-600 dark:hover:bg-yellow-600 hover:scale-110 hover:text-white rounded-lg px-2 py-0.5 duration-150 transition-all`} >
{tag.name}
- {tag.count ? ( + {tag.count + ? ( {tag.count} - ) : ( + ) + : ( <> - )} + )}
) From 26ca5cde27ef4f3027a3fc54f4ff8669f5e6cafa Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 17:58:16 +0800 Subject: [PATCH 3/4] check --- themes/heo/components/TagGroups.js | 52 ++++++++++++++---------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/themes/heo/components/TagGroups.js b/themes/heo/components/TagGroups.js index 5087ad5f..34bf1839 100644 --- a/themes/heo/components/TagGroups.js +++ b/themes/heo/components/TagGroups.js @@ -14,34 +14,30 @@ const TagGroups = ({ tags, className }) => { if (!tags) return <> return ( -
- {tags.map((tag, index) => { - const selected = currentTag === tag.name - return ( - -
-
{tag.name}
- {tag.count - ? ( - {tag.count} - ) - : ( - <> - )} -
- - ) - })} -
+
+ {tags.map((tag, index) => { + const selected = currentTag === tag.name + return ( + +
+
{tag.name}
+ {tag.count + ? ( + {tag.count} + ) + : ( + <> + )} +
+ + ) + })} +
) } From 9b80f7c3d12ca9e66d325fa8889ecbfb64cf7db0 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sun, 4 Feb 2024 18:17:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 153 ++++++++++++++++++++++++++------------------------- yarn.lock | 5 ++ 2 files changed, 82 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 6a679668..df145844 100644 --- a/package.json +++ b/package.json @@ -1,77 +1,78 @@ { - "name": "notion-next", - "version": "4.2.3", - "homepage": "https://github.com/tangly1024/NotionNext.git", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/tangly1024/NotionNext.git" - }, - "author": { - "name": "tangly", - "email": "mail@tangly1024.com", - "url": "http://tangly1024.com" - }, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "post-build": "next-sitemap --config next-sitemap.config.js", - "export": "next build && next-sitemap --config next-sitemap.config.js && next export", - "bundle-report": "ANALYZE=true yarn build" - }, - "dependencies": { - "@giscus/react": "^2.2.6", - "@headlessui/react": "^1.7.15", - "@next/bundle-analyzer": "^12.1.1", - "@vercel/analytics": "^1.0.0", - "algoliasearch": "^4.18.0", - "animejs": "^3.2.1", - "aos": "^3.0.0-beta.6", - "axios": ">=0.21.1", - "copy-to-clipboard": "^3.3.1", - "eslint-plugin-react-hooks": "^4.6.0", - "feed": "^4.2.2", - "js-md5": "^0.7.3", - "localStorage": "^1.0.4", - "lodash.throttle": "^4.1.1", - "memory-cache": "^0.2.0", - "mongodb": "^4.6.0", - "next": "13.3.1", - "notion-client": "6.15.6", - "notion-utils": "6.15.6", - "nprogress": "^0.2.0", - "preact": "^10.5.15", - "prism-themes": "1.9.0", - "react": "^18.2.0", - "react-cookies": "^0.1.1", - "react-dom": "^18.2.0", - "react-facebook": "^8.1.4", - "react-notion-x": "6.16.0", - "react-share": "^4.4.1", - "react-tweet-embed": "~2.0.0", - "typed.js": "^2.0.12" - }, - "devDependencies": { - "@waline/client": "^2.5.1", - "autoprefixer": "^10.4.13", - "eslint": "^7.26.0", - "eslint-config-next": "^13.1.1", - "eslint-config-standard": "^16.0.2", - "eslint-plugin-import": "^2.23.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.23.2", - "next-sitemap": "^1.6.203", - "postcss": "^8.4.31", - "tailwindcss": "^3.3.2", - "webpack-bundle-analyzer": "^4.5.0" - }, - "resolutions": { - "axios": ">=0.21.1" - }, - "bugs": { - "url": "https://github.com/tangly/NotionNext/issues", - "email": "tlyong1992@hotmail.com" - } -} + "name": "notion-next", + "version": "4.2.3", + "homepage": "https://github.com/tangly1024/NotionNext.git", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tangly1024/NotionNext.git" + }, + "author": { + "name": "tangly", + "email": "mail@tangly1024.com", + "url": "http://tangly1024.com" + }, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "post-build": "next-sitemap --config next-sitemap.config.js", + "export": "next build && next-sitemap --config next-sitemap.config.js && next export", + "bundle-report": "ANALYZE=true yarn build" + }, + "dependencies": { + "@giscus/react": "^2.2.6", + "@headlessui/react": "^1.7.15", + "@next/bundle-analyzer": "^12.1.1", + "@vercel/analytics": "^1.0.0", + "algoliasearch": "^4.18.0", + "animejs": "^3.2.1", + "aos": "^3.0.0-beta.6", + "axios": ">=0.21.1", + "copy-to-clipboard": "^3.3.1", + "feed": "^4.2.2", + "js-md5": "^0.7.3", + "localStorage": "^1.0.4", + "lodash.throttle": "^4.1.1", + "memory-cache": "^0.2.0", + "mongodb": "^4.6.0", + "next": "13.3.1", + "notion-client": "6.15.6", + "notion-utils": "6.15.6", + "nprogress": "^0.2.0", + "preact": "^10.5.15", + "prism-themes": "1.9.0", + "react": "^18.2.0", + "react-cookies": "^0.1.1", + "react-dom": "^18.2.0", + "react-facebook": "^8.1.4", + "react-notion-x": "6.16.0", + "react-share": "^4.4.1", + "react-tweet-embed": "~2.0.0", + "typed.js": "^2.0.12" + }, + "devDependencies": { + "@waline/client": "^2.5.1", + "autoprefixer": "^10.4.13", + "eslint": "^7.26.0", + "eslint-config-next": "^13.1.1", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-import": "^2.23.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react-hooks": "^4.6.0", + "next-sitemap": "^1.6.203", + "postcss": "^8.4.31", + "prettier": "3.2.5", + "tailwindcss": "^3.3.2", + "webpack-bundle-analyzer": "^4.5.0" + }, + "resolutions": { + "axios": ">=0.21.1" + }, + "bugs": { + "url": "https://github.com/tangly/NotionNext/issues", + "email": "tlyong1992@hotmail.com" + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 2e04c14b..1d1a0511 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4131,6 +4131,11 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier@3.2.5: + version "3.2.5" + resolved "https://r.cnpmjs.org/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + prism-themes@1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/prism-themes/-/prism-themes-1.9.0.tgz#19c034f3205f1e28d75d89728e54ccd745f7e3dd"