-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show and remove filter, change design (#156)
Co-authored-by: Mathilde Haukø Haugum <[email protected]>
- Loading branch information
1 parent
230cad1
commit 0f818e4
Showing
10 changed files
with
250 additions
and
65 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
frontend/src/app/[organisation]/bemanning/api/departments/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { fetchWithToken } from "@/data/fetchWithToken"; | ||
import { Department } from "@/types"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export async function GET(request: Request) { | ||
const { searchParams } = new URL(request.url); | ||
const organisationName = searchParams.get("organisationName") || ""; | ||
|
||
const departments = | ||
(await fetchWithToken<Department[]>( | ||
`organisations/${organisationName}/departments`, | ||
)) ?? []; | ||
|
||
return NextResponse.json(departments); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,7 @@ | ||
import DepartmentFilter from "@/components/DepartmentFilter"; | ||
import SearchBarComponent from "@/components/SearchBarComponent"; | ||
|
||
export default function BemanningLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<div className="flex flex-row"> | ||
<div className="bg-primary_l4 py-6 px-4 flex flex-col gap-6 min-h-screen"> | ||
<h3 className="">Filter</h3> | ||
<SearchBarComponent /> | ||
<DepartmentFilter /> | ||
</div> | ||
|
||
<div className="p-6 w-full">{children}</div> | ||
</div> | ||
); | ||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client"; | ||
import { useSearchParams } from "next/navigation"; | ||
import { Filter } from "react-feather"; | ||
|
||
export default function ActiveFilters() { | ||
const searchParams = useSearchParams(); | ||
|
||
const currentNameSearch = | ||
searchParams.get("search") != "" | ||
? `"` + searchParams.get("search") + `"` | ||
: ""; | ||
const filteredDepartments = | ||
searchParams.get("filter") != "" | ||
? searchParams.get("filter")?.split(",").join(", ") | ||
: ""; | ||
const filterSummaryText = | ||
filteredDepartments != "" && currentNameSearch != "" | ||
? [filteredDepartments, currentNameSearch].join(", ").replace(/,^/, "") | ||
: filteredDepartments + currentNameSearch; | ||
|
||
return ( | ||
<> | ||
{filterSummaryText != "" && ( | ||
<div className="flex flex-row gap-[5px] text-primary_default items-center"> | ||
<Filter size="12" />{" "} | ||
<p className="body-small-bold"> {filterSummaryText} </p> | ||
</div> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.