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

Add dropdown to recruitment header #1629

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
26 changes: 25 additions & 1 deletion frontend/src/Components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import type { RecruitmentDto } from '~/dto';
import { useDesktop, useScrollY } from '~/hooks';
import { STATUS } from '~/http_status_codes';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { dbT } from '~/utils';
import styles from './Navbar.module.scss';
import { HamburgerMenu, LanguageButton, NavbarItem } from './components';

Expand Down Expand Up @@ -107,6 +109,26 @@ export function Navbar() {
</>
);

const showActiveRecruitments = activeRecruitments !== undefined && activeRecruitments?.length > 0;

const recruitmentLinks = showActiveRecruitments && (
<>
{activeRecruitments?.map((recruitment) => (
<Link
key={recruitment.id}
url={reverse({
pattern: ROUTES.frontend.organization_recruitment,
urlParams: { recruitmentId: recruitment?.id },
})}
className={styles.navbar_dropdown_link}
onAfterClick={() => setExpandedDropdown('')}
>
{dbT(recruitment, 'name')} {recruitment.organization.toString()}
</Link>
))}
</>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lag en egen PR på dropdown links for opptak. Det er ikke sikkert vi skal vise flere pågående opptak på samme side. Sannsynligvis skal vi ha et "hovedopptak" som vises når man går til /recruitment. Andre opptak skal sannsynligvis kun promoteres fra UKA/ISFiT sin nettside

Copy link
Member

Choose a reason for hiding this comment

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

^

Tror ikke vi burde fremheve alle opptak uten å bli enige med UKA, ISFiT og Samf om hvordan det skal gjøres


const navbarHeaders = (
<div className={isDesktop ? styles.navbar_main_links : styles.navbar_main_links_mobile}>
<NavbarItem
Expand All @@ -133,7 +155,9 @@ export function Navbar() {
expandedDropdown={expandedDropdown}
route={ROUTES.frontend.recruitment}
label={t(KEY.common_volunteer)}
labelClassName={activeRecruitments && styles.active_recruitment}
labelClassName={showActiveRecruitments ? styles.active_recruitment : ''}
dropdownLinks={recruitmentLinks}
showDropDownIcon={false}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type NavbarItemProps = {
labelClassName?: string;
dropdownLinks?: Children;
expandedDropdown?: string;
showDropDownIcon?: boolean;
setExpandedDropdown: SetState<string>;
};

Expand All @@ -26,6 +27,7 @@ export function NavbarItem({
setExpandedDropdown,
dropdownLinks,
labelClassName,
showDropDownIcon = true,
}: NavbarItemProps) {
const { setIsMobileNavigation } = useGlobalContext();
const isDesktop = useDesktop();
Expand Down Expand Up @@ -67,7 +69,7 @@ export function NavbarItem({
<Link to={route} className={isDesktop ? styles.navbar_link : styles.popup_link_mobile} onClick={handleClick}>
{icon && <Icon icon={icon} className={styles.navbar_item_icon} />}
<span className={labelClassName}>{label}</span>
{dropdownLinks && (
{dropdownLinks && showDropDownIcon && (
<Icon
icon={iconDown}
width={18}
Expand Down
Loading