Skip to content

Commit

Permalink
Dropdown design fix (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigridge authored Dec 4, 2023
1 parent 3b1bdf1 commit c5f053a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/DropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function DropDown({
setIsDropDownOpen(false);
setChosenOption(option);
}}
className="hover:bg-primary px-3 py-2 rounded-md hover:bg-opacity-10 flex flex-row justify-between items-center"
className="hover:bg-primary px-3 py-2 rounded hover:bg-opacity-10 flex flex-row justify-between items-center"
>
<p className="h-6 flex items-center normal-semibold text-primary">
{option}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default async function NavBar() {
</div>
<div className="flex flex-row gap-4 items-center">
<NavBarOrganisationDropdown organisations={orgs} />
<div className="w-[1px] h-8 bg-white/20" />
<NavBarUserIcon />
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/NavBar/NavBarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ export default function NavBarDropdown(props: { initial: string }) {
</p>
</button>
<div
className={`absolute right-0 top-[48px] z-50 rounded text-primary bg-white flex flex-col w-[138px] shadow-xl p-1 ${
className={`absolute right-0 top-[48px] z-50 rounded-lg text-primary bg-white flex flex-col w-[138px] shadow-xl p-1 ${
!isOpen && "hidden"
}`}
>
<button
className="px-3 py-2 rounded flex flex-row gap-3 hover:bg-primary/10"
className="hover:bg-primary/10 px-3 py-2 rounded flex flex-row gap-3 items-center "
onClick={() => signOut()}
>
<LogOut className="w-4 h-4" />
<p className="normal">Logg ut</p>
<LogOut className="w-6 h-6" />
<p className="h-6 flex items-center normal-semibold text-primary">
Logg ut
</p>
</button>
</div>
</div>
Expand Down
27 changes: 20 additions & 7 deletions frontend/src/components/NavBar/NavBarOrganisationDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useOutsideClick } from "@/hooks/useOutsideClick";
import { Organisation } from "@/types";
import { usePathname } from "next/navigation";
import Link from "next/link";
import { Check, ChevronDown, ChevronUp } from "react-feather";

export default function NavBarOrganisationDropdown({
organisations,
Expand All @@ -29,28 +30,40 @@ export default function NavBarOrganisationDropdown({
{currentOrganisation && (
<>
<button
className="border-r border-white/20 py-2"
className={`p-2 rounded flex gap-2 text-white ${
organisations.length > 1 && "hover:bg-white/10"
}`}
onClick={() => setIsOpen(!isOpen)}
disabled={organisations.length == 1}
>
<p className="normal-medium text-white pr-4">
{currentOrganisation?.name}
</p>
<p className="normal-medium">{currentOrganisation?.name}</p>
{organisations.length > 1 &&
(isOpen ? (
<ChevronUp className="h-4 w-4" />
) : (
<ChevronDown className="h-4 w-4" />
))}
</button>
<div
className={`absolute right-0 top-[48px] z-50 rounded text-primary bg-white flex flex-col w-[138px] shadow-xl p-1 ${
className={`absolute right-0 top-[48px] z-50 rounded-lg text-primary bg-white flex flex-col w-[138px] shadow-xl p-1 ${
!isOpen && "hidden"
}`}
>
{organisations.map((organisation, index) => (
<Link
key={index}
className="px-3 py-2 rounded flex flex-row gap-3 hover:bg-primary/10"
className="hover:bg-primary/10 px-3 py-2 rounded flex flex-row justify-between items-center "
href={`/${organisation.urlKey}/bemanning`}
onClick={() =>
localStorage.setItem("chosenUrlKey", organisation.urlKey)
}
>
<p className="normal">{organisation.name}</p>
<p className="h-6 flex items-center normal-semibold text-primary">
{organisation.name}
</p>
{organisation == currentOrganisation && (
<Check className="h-6 w-6 text-primary" />
)}
</Link>
))}
</div>
Expand Down

0 comments on commit c5f053a

Please sign in to comment.