From 2cd78233e98534f1206cb36b63331adcc8b9ce04 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 27 May 2022 21:11:51 +0430 Subject: [PATCH] Multi tags support! (Beta) + Bug fix --- src/App.js | 4 ++-- src/componets/AddModal.js | 9 +++++---- src/componets/List.js | 9 ++++++--- src/styles/List.css | 39 ++++++++++++++++++++++++++++++++------- src/styles/index.css | 4 ++++ 5 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/App.js b/src/App.js index 3197c4a..03c3bd1 100644 --- a/src/App.js +++ b/src/App.js @@ -17,9 +17,9 @@ function App() { function search(e) { setSearchQuery(e.target.value); } - + // || e.tag.toLowerCase().includes(searchQuery.toLowerCase()) const filteredData = data.filter((e) => { - return (e.name.toLowerCase().includes(searchQuery.toLowerCase()) || e.title.toLowerCase().includes(searchQuery.toLowerCase()) || e.tag.toLowerCase().includes(searchQuery.toLowerCase())) + return (e.name.toLowerCase().includes(searchQuery.toLowerCase()) || e.title.toLowerCase().includes(searchQuery.toLowerCase())) }); async function fetchData() { diff --git a/src/componets/AddModal.js b/src/componets/AddModal.js index c44ee81..c50d335 100644 --- a/src/componets/AddModal.js +++ b/src/componets/AddModal.js @@ -6,7 +6,7 @@ import config from '../config.json'; const AddModal = ({onExit, reFetch}) => { const [name, setName] = useState(''); const [link, setLink] = useState(''); - const [tag, setTag] = useState(''); + const [tag, setTag] = useState([]); function SetName(e) { setName(e.target.value); @@ -17,7 +17,8 @@ const AddModal = ({onExit, reFetch}) => { } function SetTag(e) { - setTag(e.target.value); + setTag([e.target.value]); + setTag(e.target.value.split(/(\s+)/).filter( e => e.trim().length > 0).map(e => e.toLowerCase())) } async function submitBookmark() { @@ -44,7 +45,7 @@ const AddModal = ({onExit, reFetch}) => { body: JSON.stringify({ _id: nanoid(), name: name, - title: null, + title: '', link: link, tag: tag }), @@ -84,7 +85,7 @@ const AddModal = ({onExit, reFetch}) => {

Link:

Tag:

- + diff --git a/src/componets/List.js b/src/componets/List.js index c9d12f0..75aede0 100644 --- a/src/componets/List.js +++ b/src/componets/List.js @@ -34,10 +34,13 @@ const List = ({data, reFetch}) => {
-
{i + 1}. {e.name}
+
{i + 1}. {e.name} ({url.hostname})
{e.title}
-
{url.hostname}
-
{e.tag}
+
+ {e.tag.map((e, i) => { + return
{e}
+ })} +
deleteEntity(e._id)}>
diff --git a/src/styles/List.css b/src/styles/List.css index e614537..d48dd06 100644 --- a/src/styles/List.css +++ b/src/styles/List.css @@ -11,10 +11,11 @@ user-select: none; position: absolute; filter: blur(5px); - opacity: 60%; + opacity: 50%; margin: 20px; width: 100px; height: 100px; + transition: opacity 0.3s; } .img-content-grp { @@ -32,26 +33,41 @@ margin: 20px; } +.list-row:hover img { + opacity: 90%; +} + .list-entity-content { - text-shadow: 1px 1px 2px black; + text-shadow: 0px 1px 3px #1f2c38; z-index: 0; - margin-left: 50px; + margin-left: 70px; padding: 20px; justify-content: space-between; display: flex; flex-direction: column; + pointer-events: none; } .list a { + white-space: nowrap; + font-family: 'Font Awesome 5 Free'; + pointer-events: all; text-decoration: none; color: rgb(194, 193, 193); font-size: 1rem; } -.list a:hover { - text-decoration: underline; +.list a::after { + content: " "; + opacity: 0%; + transition: opacity 0.1s; } +.list a:hover::after { + opacity: 100%; +} + + .delete { color: white; cursor: pointer; @@ -73,9 +89,9 @@ font-size: 2rem; } -.tag { +.tags { + display: flex; margin: 10px; - border: solid; border-width: 1px; width: fit-content; padding: 10px; @@ -83,6 +99,15 @@ border-radius: 5px; } +.tags div { + margin-right: 10px; + color: rgb(126, 208, 255); +} + +.tags div::before { + content: "#"; +} + .num { font-size: 1rem; } \ No newline at end of file diff --git a/src/styles/index.css b/src/styles/index.css index 438068b..6be3698 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -7,3 +7,7 @@ body { -moz-osx-font-smoothing: grayscale; background-color: #1f2c38; } + +*::selection { + background-color: rgba(101, 142, 255, 0.335); +} \ No newline at end of file