aside links

This commit is contained in:
VividTruthKeeper 2022-09-22 00:30:41 +05:00
parent fd0d2b12c3
commit 990bd6981e
3 changed files with 32 additions and 8 deletions

View File

@ -67,6 +67,11 @@
cursor: default !important;
background: transparent !important;
font-size: 1.4rem;
svg {
width: 3rem;
height: 3rem;
}
}
}
}

View File

@ -12,6 +12,8 @@ import { MdOutlineManageAccounts } from "react-icons/md";
import { FaAlignLeft } from "react-icons/fa";
import { FaSignOutAlt } from "react-icons/fa";
import { FaSourcetree } from "react-icons/fa";
import { FaLink } from "react-icons/fa";
import { FaRegPlusSquare } from "react-icons/fa";
// Types
import { userContextType } from "../types/user";
@ -44,18 +46,34 @@ const Aside = ({ aside, setAside }: Props) => {
<span>Posts</span>
</Link>
</li>
<li className="aside__list__element aside__list__element--title">
<IconContext.Provider value={{ color: "#8DD77F" }}>
<FaSourcetree />
</IconContext.Provider>
<h2>Source</h2>
</li>
<li className="aside__list__element">
<Link
to={"/source"}
onClick={() => localStorage.setItem("lastLocation", "/source")}
>
<IconContext.Provider value={{ color: "#8DD77F" }}>
<FaSourcetree />
<FaLink className="aside__list__element__img" />
</IconContext.Provider>
<span>Source</span>
</Link>
</li>
<li className="aside__list__element">
<Link to={"/source/create"}>
<IconContext.Provider value={{ color: "#8DD77F" }}>
<FaRegPlusSquare className="aside__list__element__img" />
</IconContext.Provider>
<span>Create source</span>
</Link>
</li>
<li className="aside__list__element aside__list__element--title">
<IconContext.Provider value={{ color: "#8DD77F" }}>
<MdOutlineManageAccounts className="aside__img" />

View File

@ -18,18 +18,19 @@ import { capitalizeFirstLetter } from "../helpers/stringMethods";
import { ContextType } from "../types/context";
const Post = () => {
const date = new Date("0.0.0000");
const [postData, setPostData] = useState<PostType>();
const { posts } = useContext<ContextType>(PostContext).postValue;
const { id } = useParams();
useEffect(() => {
if (posts[0].id !== -1) {
posts.map((post: PostType) => {
if (post.id.toString() === id) {
setPostData(post);
}
});
if (posts) {
if (posts[0].id !== -1) {
posts.map((post: PostType) => {
if (post.id.toString() === id) {
setPostData(post);
}
});
}
}
}, [posts]);
return (