Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dropdown for component category in the sidebar #6089

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions src/components/SistentNavigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { HiOutlineChevronLeft } from "@react-icons/all-files/hi/HiOutlineChevron
import { Link } from "gatsby";
import { IoMdClose } from "@react-icons/all-files/io/IoMdClose";
import { IoIosArrowDropdownCircle } from "@react-icons/all-files/io/IoIosArrowDropdownCircle";
import { componentsData } from "../../sections/Projects/Sistent/components";

import TOCWrapper from "./toc.style";
import { IoIosArrowDown } from "@react-icons/all-files/io/IoIosArrowDown";
Expand All @@ -16,6 +17,9 @@ const TOC = () => {
const [expandIdenity, setExpandIdentity] = useState(
location.pathname.includes("/identity")
);
const [expandComponent, setExpandComponent] = useState(
location.pathname.includes("/components")
);

return (
<TOCWrapper>
Expand Down Expand Up @@ -114,13 +118,36 @@ const TOC = () => {
</div>
</li>
<li>
<Link
to="/projects/sistent/components"
activeClassName="active"
className="toc-sub-heading toc-sub-inline"
>
Components
</Link>
<div>
<li
className="toc-sub-heading components"
onClick={() => setExpandComponent((prev) => !prev)}
>
Components
{expandComponent ? <IoIosArrowUp /> : <IoIosArrowDown />}
</li>
{expandComponent && (
<div className="components-sublinks">
<li>
{componentsData.map((component) => (
<li key={component.id}>
<Link
to={component.url}
className={`toc-sub-heading toc-sub-inline components-item ${
location.pathname.includes(component.url)
? "active"
: ""
}`}
activeClassName="active"
>
{component.name}
</Link>
</li>
))}
</li>
</div>
)}
</div>
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/SistentNavigation/toc.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const TOCWrapper = styled.div`
background-color: transparent;
}

.identity {
.identity, .components {
display: flex;
width: 100%;
justify-content: space-between;
Expand All @@ -138,10 +138,10 @@ const TOCWrapper = styled.div`
}
}

.identity-sublinks {
.identity-sublinks, .components-sublinks {
padding-left: 0.56rem;

.identity-item {
.identity-item, .components-item {
font-size: 1.05rem;
margin-top: 0.45rem;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sections/Projects/Sistent/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import useDataList from "../../../../utils/usedataList";
import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
import { Link } from "gatsby";

const componentsData = [
export const componentsData = [
{
id: 1,
name: "Button",
Expand Down