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

249 fix week jump and div styling #250

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion frontend/src/app/[organisation]/bemanning/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default async function Bemanning({
>
<StaffingSidebar />

<div className="main pl-12 p-6 w-full">
<div className="main pl-12 p-6 w-full flex flex-col gap-8">
<h1>Bemanning</h1>
<FilteredConsultantsList />
<InfoPillDescriptions />
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/ActiveFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ export default function ActiveFilters() {

return (
<>
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
{filterSummaryText != "" && (
{filterSummaryText != "" ? (
<div className="flex flex-row gap-[5px] text-primary_default items-center">
<Filter size="12" />{" "}
<p className="body-small-bold"> {filterSummaryText} </p>
</div>
) : (
<div className="h-4" />
)}
</>
);
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/components/AvailabilityFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ export default function AvailabilityFilter() {
return (
<div className="flex flex-col gap-2">
<p className="body-small">Status</p>
<div className="flex flex-col gap-2 w-52">
<FilterButton
label={"Ledig tid"}
onClick={() => toggleAvailabilityFilter(!availabilityFilterOn)}
checked={availabilityFilterOn}
/>
</div>
<FilterButton
label={"Ledig tid"}
onClick={() => toggleAvailabilityFilter(!availabilityFilterOn)}
checked={availabilityFilterOn}
/>
</div>
);
}
28 changes: 13 additions & 15 deletions frontend/src/components/DepartmentFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ export default function DepartmentFilter() {
});

return (
<div>
<div className="flex flex-col gap-2">
<p className="body-small">Avdeling</p>
<div className="flex flex-col gap-2 w-52">
{departments?.map((department, index) => (
<FilterButton
key={department.id}
label={department.name}
onClick={() => toggleDepartmentFilter(department)}
checked={filteredDepartments
.map((d) => d.id)
.includes(department.id)}
/>
))}
</div>
<div className="flex flex-col gap-2">
<p className="body-small">Avdeling</p>
<div className="flex flex-col gap-2 w-52">
{departments?.map((department, index) => (
<FilterButton
key={department.id}
label={department.name}
onClick={() => toggleDepartmentFilter(department)}
checked={filteredDepartments
.map((d) => d.id)
.includes(department.id)}
/>
))}
</div>
</div>
);
Expand Down
28 changes: 13 additions & 15 deletions frontend/src/components/ExperienceFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@ export default function ExperienceFilter() {

if (yearRanges.length > 0) {
return (
<div>
<div className="flex flex-col gap-2">
<p className="body-small">Erfaring</p>
<div className="flex flex-col gap-2 w-52">
{yearRanges?.map((range, index) => (
<FilterButton
key={range.label}
label={range.label}
onClick={() => toggleYearFilter(range)}
checked={filteredYears
.map((y) => y.urlString)
.includes(range.urlString)}
/>
))}
</div>
<div className="flex flex-col gap-2">
<p className="body-small">Erfaring</p>
<div className="flex flex-col gap-2 w-52">
{yearRanges?.map((range, index) => (
<FilterButton
key={range.label}
label={range.label}
onClick={() => toggleYearFilter(range)}
checked={filteredYears
.map((y) => y.urlString)
.includes(range.urlString)}
/>
))}
</div>
</div>
);
Expand Down
13 changes: 5 additions & 8 deletions frontend/src/components/FilteredConsultantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default function FilteredConsultantList() {
}

return (
<div>
<div>
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-4">
<ActiveFilters />
<WeekSelection />
</div>
Expand All @@ -32,12 +32,9 @@ export default function FilteredConsultantList() {
<th colSpan={2}>
<div className="flex flex-row gap-3 pb-4 items-center">
<p className="body-large-bold ">Konsulenter</p>

<div className="rounded-full bg-primary_l3 px-2 py-1">
<p className="text-primary_default body-small-bold">
{consultants?.length}
</p>
</div>
<p className="text-primary_default body-small-bold rounded-full bg-primary_l3 px-2 py-1">
{consultants?.length}
</p>
</div>
</th>
{consultants.at(0)?.bookings?.map((booking) => (
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/components/IconSecondaryButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ReactElement } from "react";

export default function IconSecondaryButton({
label,
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
onClick,
}: {
label: ReactElement;
onClick?: () => void;
}) {
return (
<button
className="p-2 text-primary_default rounded-lg border border-primary_l1 justify-center items-center gap-2 inline-flex hover:bg-primary_default hover:border-primary_default hover:bg-opacity-10"
onClick={onClick}
>
{label}
</button>
);
}
2 changes: 1 addition & 1 deletion frontend/src/components/InfoPillDescriptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AlertTriangle, Calendar, Coffee, FileText, Sun } from "react-feather";

export default function InfoPillDescriptions() {
return (
<div className="mt-8 flex flex-row gap-2">
<div className="flex flex-row gap-2">
<InfoPill
text={"Ledig tid"}
colors="bg-free_light text-free_dark"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/PrimaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default function PrimaryButton({
}) {
return (
<button
className="h-10 p-3 bg-primary_default rounded-lg justify-center items-center gap-2 inline-flex"
className="h-10 p-3 bg-primary_default rounded-lg justify-center items-center gap-2 inline-flex text-white text-sm leading-none"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Påmindelse: bruk CSS styling for font

onClick={onClick}
>
<div className="text-white text-sm leading-none">{label}</div>
{label}
</button>
);
}
6 changes: 3 additions & 3 deletions frontend/src/components/SearchBarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export default function SearchBarComponent({
onFocus={() => console.log("F")}
/>
) : (
<div className={`flex flex-col gap-2 rounded-lg`}>
<div className={`flex flex-col gap-2`}>
<p className="body-small">Søk</p>
<div
className={`flex flex-row gap-2 border
className={`flex flex-row gap-2 border rounded-lg
px-3 py-2 w-full hover:bg-primary_l4 hover:border-primary_default ${
searchIsActive ? "border-primary_default" : "border-primary_l1"
} `}
Expand All @@ -68,7 +68,7 @@ export default function SearchBarComponent({
value={currentNameSearch}
onFocus={() => setIsSearchActive(true)}
onBlur={() => setIsSearchActive(false)}
></input>
/>
</div>
</div>
)}
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/SecondaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ export default function SecondaryButton({
}) {
return (
<button
className="h-10 p-3 rounded-lg border border-primary_l1 justify-center items-center gap-2 inline-flex hover:bg-primary_default hover:border-primary_default hover:bg-opacity-10"
className="h-10 p-3 rounded-lg border border-primary_l1 justify-center items-center gap-2 inline-flex hover:bg-primary_default hover:border-primary_default hover:bg-opacity-10 text-primary_default text-sm font-semibold leading-none"
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
onClick={onClick}
>
<div className=" text-primary_default text-sm font-semibold leading-none">
{label}
</div>
{label}
</button>
);
}
2 changes: 1 addition & 1 deletion frontend/src/components/StaffingSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function StaffingSidebar() {
<div className="sidebar z-10">
{!isSidebarHidden ? (
<div className=" bg-primary_l4 h-full flex flex-col gap-6 p-8 w-[300px]">
<div className="flex flex-row justify-between">
<div className="flex flex-row justify-between items-center">
<h3 className="">Filter</h3>
<button
onClick={() => setIsSidebarHidden(true)}
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/WeekSelection.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
"use client";
import { useFilteredConsultants } from "@/hooks/useFilteredConsultants";
import SecondaryButton from "@/components/SecondaryButton";
import { ArrowLeft, ArrowRight } from "react-feather";
import IconSecondaryButton from "./IconSecondaryButton";

export default function WeekSelection() {
const { incrementSelectedWeek, resetSelectedWeek, decrementSelectedWeek } =
useFilteredConsultants();

return (
<div className="flex flex-row gap-1">
<SecondaryButton label={"<"} onClick={decrementSelectedWeek} />
<SecondaryButton label={"Denne uka"} onClick={resetSelectedWeek} />
<SecondaryButton label={">"} onClick={incrementSelectedWeek} />
<IconSecondaryButton
label={<ArrowLeft size={24} />}
onClick={decrementSelectedWeek}
/>
<IconSecondaryButton
label={<ArrowRight size={24} />}
onClick={incrementSelectedWeek}
/>
</div>
);
}
4 changes: 2 additions & 2 deletions frontend/src/hooks/useFilteredConsultants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function useFilteredConsultants() {
})
: DateTime.now();

let newDate = date.plus({ week: 1 });
let newDate = date.plus({ week: 7 }); // change to shownWeeks when week filter is added
mathildehaugum marked this conversation as resolved.
Show resolved Hide resolved
updateRoute({
week: { year: newDate.year, weekNumber: newDate.weekNumber },
});
Expand All @@ -83,7 +83,7 @@ export function useFilteredConsultants() {
})
: DateTime.now();

let newDate = date.plus({ week: -1 });
let newDate = date.plus({ week: -7 });
updateRoute({
week: { year: newDate.year, weekNumber: newDate.weekNumber },
});
Expand Down
Loading