Small change.
This commit is contained in:
parent
6fbcab4bd7
commit
69332c122a
15
src/App.js
15
src/App.js
|
@ -24,7 +24,6 @@ function App() {
|
||||||
[filterCheckbox, setFilterCheckbox] = useState([true, true, true]),
|
[filterCheckbox, setFilterCheckbox] = useState([true, true, true]),
|
||||||
[sortBy, setSortBy] = useState(1),
|
[sortBy, setSortBy] = useState(1),
|
||||||
[loader, setLoader] = useState(false),
|
[loader, setLoader] = useState(false),
|
||||||
[path, setPath] = useState("/"),
|
|
||||||
[lightMode, setLightMode] = useState(
|
[lightMode, setLightMode] = useState(
|
||||||
localStorage.getItem("light-mode") === "true"
|
localStorage.getItem("light-mode") === "true"
|
||||||
),
|
),
|
||||||
|
@ -58,10 +57,6 @@ function App() {
|
||||||
setToggle(!toggle);
|
setToggle(!toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPath(pathname) {
|
|
||||||
setPath(pathname);
|
|
||||||
}
|
|
||||||
|
|
||||||
const filteredData = filter(data, searchQuery, filterCheckbox);
|
const filteredData = filter(data, searchQuery, filterCheckbox);
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
|
@ -78,11 +73,6 @@ function App() {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [sortBy, filterCheckbox]);
|
}, [sortBy, filterCheckbox]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const currentURL = new URL(window.location.href);
|
|
||||||
SetPath(currentURL.pathname);
|
|
||||||
}, [path]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
@ -123,7 +113,7 @@ function App() {
|
||||||
<input
|
<input
|
||||||
className="search"
|
className="search"
|
||||||
type="search"
|
type="search"
|
||||||
placeholder={` Search "${path}"`}
|
placeholder=" Search"
|
||||||
onChange={search}
|
onChange={search}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -185,7 +175,6 @@ function App() {
|
||||||
element={
|
element={
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<List
|
<List
|
||||||
SetPath={() => SetPath()}
|
|
||||||
lightMode={lightMode}
|
lightMode={lightMode}
|
||||||
SetLoader={SetLoader}
|
SetLoader={SetLoader}
|
||||||
data={filteredData}
|
data={filteredData}
|
||||||
|
@ -201,7 +190,6 @@ function App() {
|
||||||
path="tags/:tagId"
|
path="tags/:tagId"
|
||||||
element={
|
element={
|
||||||
<Tags
|
<Tags
|
||||||
SetPath={() => SetPath()}
|
|
||||||
lightMode={lightMode}
|
lightMode={lightMode}
|
||||||
SetLoader={SetLoader}
|
SetLoader={SetLoader}
|
||||||
data={filteredData}
|
data={filteredData}
|
||||||
|
@ -216,7 +204,6 @@ function App() {
|
||||||
path="collections/:collectionId"
|
path="collections/:collectionId"
|
||||||
element={
|
element={
|
||||||
<Collections
|
<Collections
|
||||||
SetPath={() => SetPath()}
|
|
||||||
lightMode={lightMode}
|
lightMode={lightMode}
|
||||||
SetLoader={SetLoader}
|
SetLoader={SetLoader}
|
||||||
data={filteredData}
|
data={filteredData}
|
||||||
|
|
|
@ -10,16 +10,11 @@ import {
|
||||||
} from 'react-awesome-button';
|
} from 'react-awesome-button';
|
||||||
import 'react-awesome-button/dist/themes/theme-blue.css';
|
import 'react-awesome-button/dist/themes/theme-blue.css';
|
||||||
|
|
||||||
const List = ({ SetPath, data, tags, collections, reFetch, SetLoader, lightMode }) => {
|
const List = ({ data, tags, collections, reFetch, SetLoader, lightMode }) => {
|
||||||
const [editBox, setEditBox] = useState(false),
|
const [editBox, setEditBox] = useState(false),
|
||||||
[editIndex, setEditIndex] = useState(0),
|
[editIndex, setEditIndex] = useState(0),
|
||||||
[numberOfResults, setNumberOfResults] = useState(0);
|
[numberOfResults, setNumberOfResults] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const currentURL = new URL(window.location.href);
|
|
||||||
SetPath(currentURL.pathname);
|
|
||||||
})
|
|
||||||
|
|
||||||
function edit(index) {
|
function edit(index) {
|
||||||
setEditBox(true);
|
setEditBox(true);
|
||||||
setEditIndex(index);
|
setEditIndex(index);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import List from "../componets/List";
|
import List from "../componets/List";
|
||||||
|
|
||||||
const Collections = ({ SetPath, data, tags, collections, SetLoader, lightMode, reFetch }) => {
|
const Collections = ({ data, tags, collections, SetLoader, lightMode, reFetch }) => {
|
||||||
const { collectionId } = useParams();
|
const { collectionId } = useParams();
|
||||||
const dataWithMatchingTag = data.filter((e) => {
|
const dataWithMatchingTag = data.filter((e) => {
|
||||||
return e.collection.includes(collectionId);
|
return e.collection.includes(collectionId);
|
||||||
|
@ -10,7 +10,6 @@ const Collections = ({ SetPath, data, tags, collections, SetLoader, lightMode, r
|
||||||
return (
|
return (
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<List
|
<List
|
||||||
SetPath={() => SetPath()}
|
|
||||||
lightMode={lightMode}
|
lightMode={lightMode}
|
||||||
data={dataWithMatchingTag}
|
data={dataWithMatchingTag}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import List from "../componets/List";
|
import List from "../componets/List";
|
||||||
|
|
||||||
const Tags = ({ SetPath, data, tags, collections, SetLoader, lightMode, reFetch }) => {
|
const Tags = ({ data, tags, collections, SetLoader, lightMode, reFetch }) => {
|
||||||
const { tagId } = useParams();
|
const { tagId } = useParams();
|
||||||
const dataWithMatchingTag = data.filter((e) => {
|
const dataWithMatchingTag = data.filter((e) => {
|
||||||
return e.tag.includes(tagId);
|
return e.tag.includes(tagId);
|
||||||
|
@ -10,7 +10,6 @@ const Tags = ({ SetPath, data, tags, collections, SetLoader, lightMode, reFetch
|
||||||
return (
|
return (
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<List
|
<List
|
||||||
SetPath={() => SetPath()}
|
|
||||||
lightMode={lightMode}
|
lightMode={lightMode}
|
||||||
data={dataWithMatchingTag}
|
data={dataWithMatchingTag}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
.search {
|
.search {
|
||||||
width: 35%;
|
width: 35%;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
font-size: 1rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +14,6 @@
|
||||||
@media (width <= 400px) {
|
@media (width <= 400px) {
|
||||||
.search {
|
.search {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
font-size: 0.6rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +44,7 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-family: "Font Awesome 5 Free";
|
font-family: "Font Awesome 5 Free";
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
font-size: 1rem;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
|
|
|
@ -39,12 +39,12 @@ body {
|
||||||
--button-raise-level: 3px;
|
--button-raise-level: 3px;
|
||||||
--button-hover-pressure: 0;
|
--button-hover-pressure: 0;
|
||||||
--transform-speed: 0.025s;
|
--transform-speed: 0.025s;
|
||||||
--button-primary-color: #273949;
|
--button-primary-color: rgba(39, 57, 73, 0.9);
|
||||||
--button-primary-color-dark: #c6e4ff;
|
--button-primary-color-dark: #c6e4ff;
|
||||||
--button-primary-color-light: #c6e4ff;
|
--button-primary-color-light: #c6e4ff;
|
||||||
--button-primary-color-hover: #0d4a7f;
|
--button-primary-color-hover: #0d4a7f;
|
||||||
--button-primary-color-active: #0f5ca0;
|
--button-primary-color-active: #0f5ca0;
|
||||||
--button-primary-border: none;
|
--button-primary-border: 2px solid #e7f4ff;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +111,11 @@ body {
|
||||||
--button-raise-level: 3px;
|
--button-raise-level: 3px;
|
||||||
--button-hover-pressure: 0;
|
--button-hover-pressure: 0;
|
||||||
--transform-speed: 0.025s;
|
--transform-speed: 0.025s;
|
||||||
--button-primary-color: #e0e0e0;
|
--button-primary-color: rgba(224, 224, 224, 0.9);
|
||||||
--button-primary-color-dark: #354c7d;
|
--button-primary-color-dark: #354c7d;
|
||||||
--button-primary-color-light: #354c7d;
|
--button-primary-color-light: #354c7d;
|
||||||
--button-primary-color-hover: #e1eaf1;
|
--button-primary-color-hover: #e1eaf1;
|
||||||
--button-primary-color-active: #e2e2e2;
|
--button-primary-color-active: #e2e2e2;
|
||||||
--button-primary-border: none;
|
--button-primary-border: 2px solid #1e88e5;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
Ŝarĝante…
Reference in New Issue