diff --git a/package-lock.json b/package-lock.json index 9bbc2cd3..93fffbcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "react-lazyload": "^3.2.0", "react-loader-spinner": "^6.0.0-0", "react-pro-sidebar": "^0.7.1", + "react-router-dom": "^6.3.0", "react-scripts": "5.0.0", "react-select": "^5.3.2", "web-vitals": "^2.1.4" @@ -8155,6 +8156,14 @@ "he": "bin/he" } }, + "node_modules/history": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", + "dependencies": { + "@babel/runtime": "^7.7.6" + } + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -13441,6 +13450,30 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.3.0.tgz", + "integrity": "sha512-7Wh1DzVQ+tlFjkeo+ujvjSqSJmkt1+8JO+T5xklPlgrh70y7ogx75ODRW0ThWhY7S+6yEDks8TYrtQe/aoboBQ==", + "dependencies": { + "history": "^5.2.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.3.0.tgz", + "integrity": "sha512-uaJj7LKytRxZNQV8+RbzJWnJ8K2nPsOOEuX7aQstlMZKQT0164C+X2w6bnkqU3sjtLvpd5ojrezAyfZ1+0sStw==", + "dependencies": { + "history": "^5.2.0", + "react-router": "6.3.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/react-scripts": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.0.tgz", @@ -22177,6 +22210,14 @@ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" }, + "history": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", + "requires": { + "@babel/runtime": "^7.7.6" + } + }, "hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -25832,6 +25873,23 @@ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" }, + "react-router": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.3.0.tgz", + "integrity": "sha512-7Wh1DzVQ+tlFjkeo+ujvjSqSJmkt1+8JO+T5xklPlgrh70y7ogx75ODRW0ThWhY7S+6yEDks8TYrtQe/aoboBQ==", + "requires": { + "history": "^5.2.0" + } + }, + "react-router-dom": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.3.0.tgz", + "integrity": "sha512-uaJj7LKytRxZNQV8+RbzJWnJ8K2nPsOOEuX7aQstlMZKQT0164C+X2w6bnkqU3sjtLvpd5ojrezAyfZ1+0sStw==", + "requires": { + "history": "^5.2.0", + "react-router": "6.3.0" + } + }, "react-scripts": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.0.tgz", diff --git a/package.json b/package.json index 583977a1..3f7cb3d5 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "react-lazyload": "^3.2.0", "react-loader-spinner": "^6.0.0-0", "react-pro-sidebar": "^0.7.1", + "react-router-dom": "^6.3.0", "react-scripts": "5.0.0", "react-select": "^5.3.2", "web-vitals": "^2.1.4" diff --git a/src/App.js b/src/App.js index c32ceb41..bdd81310 100644 --- a/src/App.js +++ b/src/App.js @@ -11,6 +11,8 @@ import concatTags from './modules/concatTags'; import NoResults from './componets/NoResults'; import Loader from './componets/Loader'; import SideBar from './componets/SideBar'; +import Tags from './routes/Tags.js'; +import { Route, Routes } from "react-router-dom"; function App() { const [data, setData] = useState([]), @@ -109,47 +111,65 @@ function App() { return (
-
-
- - - - -
+ + +
+ + + + +
- {numberOfResults > 0 ?

{numberOfResults} Bookmarks found

: null} + {numberOfResults > 0 ?

{numberOfResults} Bookmarks found

: null} - - - + + + + - {numberOfResults === 0 ? : null} + {numberOfResults === 0 ? : null} - {sortBox ? : null} + {sortBox ? : null} - {filterBox ? : null} + {filterBox ? : null} - {newBox ? tags} - /> : null} + {newBox ? tags} + /> : null} - {loader ? : null} -
+ {loader ? : null} +
} /> + + } /> + + ); } diff --git a/src/componets/SideBar.js b/src/componets/SideBar.js index f0b301a2..102273d0 100644 --- a/src/componets/SideBar.js +++ b/src/componets/SideBar.js @@ -1,6 +1,7 @@ -import { ProSidebar, SidebarHeader, SidebarFooter, SidebarContent } from 'react-pro-sidebar'; +import { ProSidebar, SidebarHeader, SidebarFooter, SidebarContent, Menu, MenuItem, SubMenu } from 'react-pro-sidebar'; import 'react-pro-sidebar/dist/css/styles.css'; import '../styles/SideBar.css'; +import { Link } from "react-router-dom"; const SideBar = ({ tags, handleToggleSidebar, toggle }) => { return ( @@ -13,11 +14,20 @@ const SideBar = ({ tags, handleToggleSidebar, toggle }) => {

LinkWarden

- -

Tags:

- {tags.map((e) => { - return

{e}

- })} + + +

View All

+ + + {tags.map((e, i) => { + const path = `/tags/${e}` + return {e} + })} + + + + +

©{new Date().getFullYear()} Made with 💙 by Daniel 31X13

diff --git a/src/index.js b/src/index.js index 6ed5681f..55f7c673 100644 --- a/src/index.js +++ b/src/index.js @@ -2,10 +2,13 @@ import React from "react"; import ReactDOM from "react-dom/client"; import "./styles/index.css"; import App from "./App"; +import { BrowserRouter } from "react-router-dom"; const root = ReactDOM.createRoot(document.getElementById("root")); root.render( - + + + ); \ No newline at end of file diff --git a/src/routes/Tags.js b/src/routes/Tags.js new file mode 100644 index 00000000..be30220b --- /dev/null +++ b/src/routes/Tags.js @@ -0,0 +1,21 @@ +import { useParams } from 'react-router-dom'; +import List from '../componets/List'; + +const Tags = ({ data }) => { + const { tagId } = useParams(); + const dataWithMatchingTag = data.filter((e) => { + return e.tag.includes(tagId) + }); + + console.log(dataWithMatchingTag) + + return ( +
+ +
+ ) +} + +export default Tags \ No newline at end of file diff --git a/src/styles/SideBar.css b/src/styles/SideBar.css index 2204c4f0..d3722b71 100644 --- a/src/styles/SideBar.css +++ b/src/styles/SideBar.css @@ -24,7 +24,6 @@ text-decoration: underline; } - .pro-sidebar-layout { background: #384952; text-shadow: none;