Skip to content

Commit

Permalink
193 list frontend (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathildehaugum authored Oct 25, 2023
1 parent a92b188 commit 41101d3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

.body-bold {
font-size: 0.9rem;
font-family: "Graphik-SemiBold";
font-family: "Graphik-Medium";
line-height: 1rem;
}

Expand Down
56 changes: 37 additions & 19 deletions frontend/src/components/ConsultantListElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,50 @@ export default function ConsultantListElement({
consultant,
}: ConsultantListElementProps) {
const [isListElementVisible, setIsListElementVisible] = useState(false);
const [isButtonHovered, setIsButtonHovered] = useState(false);

function toggleListElementVisibility() {
setIsListElementVisible(!isListElementVisible);
}

return (
<div
className={`flex flex-col ${
isListElementVisible && "bg-primary_l4"
} border-t border-primary_l4 `}
>
<button
className="flex flex-row gap-3 py-0.5 hover:bg-primary_default hover:bg-opacity-5"
onClick={toggleListElementVisibility}
>
<div className={`w-6 h-6 m-2 ${isListElementVisible && "rotate-180"}`}>
<ChevronDown className={`text-primary_default`} />
<div className="flex flex-row gap-2">
<div
className={`py-0 w-0.5 rounded-lg ${
isButtonHovered ? "bg-primary_default" : "bg-primary_l4"
} ${isListElementVisible && "bg-secondary_default"}`}
></div>
<div className="flex flex-col flex-grow">
<div
className="flex flex-row gap-2 items-center h-[52px]"
onMouseEnter={() => setIsButtonHovered(true)}
onMouseLeave={() => setIsButtonHovered(false)}
>
<button
className={`p-2 rounded-lg hover:bg-primary_default hover:bg-opacity-10 ${
isListElementVisible && "rotate-180"
}`}
onClick={toggleListElementVisibility}
>
<ChevronDown className={`text-primary_default w-6 h-6`} />
</button>
<div className="flex flex-col gap-1">
<p
className={`text-black text-start ${
isListElementVisible ? "body-bold" : "body"
}`}
>
{consultant.name}
</p>
<p className="detail text-neutral_l1 text-start">
{`${consultant.yearsOfExperience} RÅ år`}
</p>
</div>
</div>
<div className="flex flex-col justify-center items-start">
<p className="body text-black text-sm"> {consultant.name}</p>
<p className="detail text-neutral_l1">
{`${consultant.yearsOfExperience} RÅ år`}
</p>
</div>
</button>
<div className={`${!isListElementVisible && "hidden"} h-[198px] `}></div>
<div
className={`${!isListElementVisible && "hidden"} h-[198px] `}
></div>
</div>
</div>
);
}
8 changes: 5 additions & 3 deletions frontend/src/components/FilteredConsultantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export default function FilteredConsultantList() {
</p>
</div>
</div>
{consultants?.map((consultant) => (
<ConsultantListElement key={consultant.id} consultant={consultant} />
))}
<div className="flex flex-col gap-1">
{consultants?.map((consultant) => (
<ConsultantListElement key={consultant.id} consultant={consultant} />
))}
</div>
</div>
);
}

0 comments on commit 41101d3

Please sign in to comment.