From 21494eda0e5ad5d2f039b819f53146e42f0a6415 Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sat, 2 Nov 2024 07:04:32 +0100 Subject: [PATCH] adds for controlling tab view / list view --- .../OrganizationRecruitmentPage.module.scss | 23 ++++++----- .../OrganizationRecruitmentPage.tsx | 40 ++++++++++--------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.module.scss b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.module.scss index 684795018..99715189e 100644 --- a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.module.scss +++ b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.module.scss @@ -13,7 +13,7 @@ margin: 1rem; } -.organizationHeader{ +.organizationHeader { display: grid; grid-template-columns: auto auto; align-items: center; @@ -27,12 +27,12 @@ width: 50%; aspect-ratio: 16 / 9; border: none; - @include for-tablet-down{ + @include for-tablet-down { width: 80%; } } -.basicRecruitmentSubHeader{ +.basicRecruitmentSubHeader { @include flex-row-center; width: 100%; padding: 0.25rem; @@ -40,16 +40,15 @@ text-align: center; } -.samfRecruitmentSubHeader{ +.samfRecruitmentSubHeader { @extend .basicRecruitmentSubHeader; color: white; background-color: $red-samf; } -.optionsContainer{ +.optionsContainer { @include flex-row-center; gap: 1rem; - } .personalRow { @@ -57,21 +56,23 @@ gap: 1rem; } -.ukaRecruitmentSubHeader{ +.ukaRecruitmentSubHeader { @extend .samfRecruitmentSubHeader; background-color: $blue-uka; } -.isfitRecruitmentSubHeader{ +.isfitRecruitmentSubHeader { @extend .samfRecruitmentSubHeader; background-color: $blue-isfit; } .openPositionsWrapper { - @include flex-column-center; + @include flex-column-center; width: 100%; gap: 1rem; } - - +.viewModeControll { + display: flex; + gap: 2rem; +} diff --git a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx index 8d2479493..fd209848f 100644 --- a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx +++ b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; -import { Logo, OccupiedFormModal, Page, SamfundetLogoSpinner, Text, ToggleSwitch, Video } from '~/Components'; +import { Button, Logo, OccupiedFormModal, Page, SamfundetLogoSpinner, Text, Video } from '~/Components'; import { PersonalRow } from '~/Pages/RecruitmentPage'; import { getOrganization, getRecruitment } from '~/api'; import { useOrganizationContext } from '~/context/OrgContextProvider'; @@ -14,10 +14,12 @@ import { dbT, getObjectFieldOrNumber } from '~/utils'; import { GangSeparatePositions, GangTypeContainer, RecruitmentTabs } from './Components'; import styles from './OrganizationRecruitmentPage.module.scss'; +type ViewMode = 'list' | 'tab'; + export function OrganizationRecruitmentPage() { const isDesktop = useDesktop(); const { recruitmentId } = useParams<{ recruitmentId: string }>(); - const [viewAllPositions, setViewAllPositions] = useState(true); + const [positionsViewMode, setViewMode] = useState('list'); const { t } = useTranslation(); const { changeOrgTheme, organizationTheme } = useOrganizationContext(); const [recruitment, setRecruitment] = useState(); @@ -59,11 +61,6 @@ export function OrganizationRecruitmentPage() { } }, [organizationName, changeOrgTheme]); - function toggleViewAll() { - const toggledValue = !viewAllPositions; - setViewAllPositions(toggledValue); - } - return ( {loading ? ( @@ -76,13 +73,7 @@ export function OrganizationRecruitmentPage() { {dbT(recruitment, 'name')} - {recruitment?.promo_media ? ( - <> -