Skip to content

Commit

Permalink
Merge pull request tangly1024#1872 from KazooTTT/feat/highlight-selec…
Browse files Browse the repository at this point in the history
…ted-tag

feat: highlight the selected tag
  • Loading branch information
tangly1024 authored Feb 4, 2024
2 parents e904b47 + 9b80f7c commit a234a10
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 88 deletions.
153 changes: 77 additions & 76 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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": "[email protected]"
}
}
"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": "[email protected]",
"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": "[email protected]"
}
}
37 changes: 25 additions & 12 deletions themes/heo/components/TagGroups.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Link from 'next/link'
import { useRouter } from 'next/router'

/**
* 标签组
Expand All @@ -8,22 +9,34 @@ import Link from 'next/link'
* @constructor
*/
const TagGroups = ({ tags, className }) => {
const router = useRouter()
const { tag: currentTag } = router.query
if (!tags) return <></>

return (
<div id='tags-group' className='dark:border-gray-700 space-y-2'>
{
tags.map((tag, index) => {
return <Link passHref
key={index}
href={`/tag/${encodeURIComponent(tag.name)}`}
className={'cursor-pointer inline-block whitespace-nowrap'}>
<div className={`${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`}>
<div className='text-lg'>{tag.name} </div>{tag.count ? <sup className='relative ml-1'>{tag.count}</sup> : <></>}
<div id="tags-group" className="dark:border-gray-700 space-y-2">
{tags.map((tag, index) => {
const selected = currentTag === tag.name
return (
<Link passHref key={index} href={`/tag/${encodeURIComponent(tag.name)}`}
className={'cursor-pointer inline-block whitespace-nowrap'}
>
<div className={`${className || ''}
${selected ? 'text-white bg-blue-600 dark:bg-yellow-600' : ''}
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`}
>
<div className="text-lg">{tag.name} </div>
{tag.count
? (
<sup className="relative ml-1">{tag.count}</sup>
)
: (
<></>
)}
</div>

</Link>
})
}
)
})}
</div>
)
}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==

[email protected]:
version "3.2.5"
resolved "https://r.cnpmjs.org/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==

[email protected]:
version "1.9.0"
resolved "https://registry.yarnpkg.com/prism-themes/-/prism-themes-1.9.0.tgz#19c034f3205f1e28d75d89728e54ccd745f7e3dd"
Expand Down

0 comments on commit a234a10

Please sign in to comment.