Made the Tag.jsx clickable
This commit is contained in:
@ -1,10 +1,21 @@
|
|||||||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||||
import {faTag} from "@fortawesome/free-solid-svg-icons";
|
import {faTag} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import {useContext} from "react";
|
||||||
|
import LinkContext from "@/common/contexts/Link/index.js";
|
||||||
import "./styles.sass";
|
import "./styles.sass";
|
||||||
|
|
||||||
export const Tag = (props) => (
|
export const Tag = (props) => {
|
||||||
<div className="tag">
|
const [links, updateLinks, setQuery, query, search, setSearch] = useContext(LinkContext);
|
||||||
<FontAwesomeIcon icon={faTag} />
|
|
||||||
<h3>{props.name}</h3>
|
const addQuery = () => {
|
||||||
</div>
|
if (!query.tag?.split(",").includes(props.name))
|
||||||
)
|
setSearch(`tag:"${props.name}" ${search}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="tag" onClick={addQuery}>
|
||||||
|
<FontAwesomeIcon icon={faTag}/>
|
||||||
|
<h3>{props.name}</h3>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user