Skip to content

Commit

Permalink
#8 Allow toggle hints for reference-category
Browse files Browse the repository at this point in the history
  • Loading branch information
tina-e committed Aug 20, 2022
1 parent 46d4b8b commit 01f142a
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions src/components/sidebar/SidebarHints.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Plus } from "phosphor-react";
import { CaretDown, CaretRight, Plus } from "phosphor-react";
import { useState } from "react";
import { Button } from "../Button";
import { HintProps, Hint } from "./Hint";

Expand Down Expand Up @@ -42,6 +43,11 @@ const hints: HintProps[] = [
];

export const SidebarHints = () => {
const [hintsWithReferenceOpen, setHintsWithReferenceOpen] =
useState<boolean>(true);
const [hintsWithoutReferenceOpen, setHintsWithoutReferenceOpen] =
useState<boolean>(true);

return (
<div className="flex flex-col gap-3 h-full overflow-hidden">
<div className="flex justify-between items-center pt-4 px-4">
Expand Down Expand Up @@ -69,16 +75,54 @@ export const SidebarHints = () => {
)}
<div className="flex flex-col gap-7 p-4 overflow-auto text-mediumGrey font-extrabold text-sm">
<div>
OHNE BEZUG AUF BEITRAG
{hints.map(
(hint) => !hint.referenceTo && <Hint key={hint.id} {...hint}></Hint>
{hintsWithoutReferenceOpen ? (
<CaretDown
size={14}
className="inline mr-1"
weight="bold"
onClick={() =>
setHintsWithoutReferenceOpen(!hintsWithoutReferenceOpen)
}
/>
) : (
<CaretRight
size={14}
className="inline mr-1"
weight="bold"
onClick={() =>
setHintsWithoutReferenceOpen(!hintsWithoutReferenceOpen)
}
/>
)}
OHNE BEZUG AUF BEITRAG
{hintsWithoutReferenceOpen &&
hints.map(
(hint) =>
!hint.referenceTo && <Hint key={hint.id} {...hint}></Hint>
)}
</div>
<div>
MIT BEZUG AUF BEITRAG
{hints.map(
(hint) => hint.referenceTo && <Hint key={hint.id} {...hint}></Hint>
{hintsWithReferenceOpen ? (
<CaretDown
size={14}
className="inline mr-1"
weight="bold"
onClick={() => setHintsWithReferenceOpen(!hintsWithReferenceOpen)}
/>
) : (
<CaretRight
size={14}
className="inline mr-1"
weight="bold"
onClick={() => setHintsWithReferenceOpen(!hintsWithReferenceOpen)}
/>
)}
MIT BEZUG AUF BEITRAG
{hintsWithReferenceOpen &&
hints.map(
(hint) =>
hint.referenceTo && <Hint key={hint.id} {...hint}></Hint>
)}
</div>
</div>
</div>
Expand Down

0 comments on commit 01f142a

Please sign in to comment.