-
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.
Merge branch 'master' into feature/addinterviewgroup
- Loading branch information
Showing
109 changed files
with
1,892 additions
and
795 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
backend/samfundet/migrations/0010_recruitment_promo_media.py
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,18 @@ | ||
# Generated by Django 5.1.1 on 2024-10-31 19:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('samfundet', '0009_recruitmentpositionsharedinterviewgroup_name_en_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='recruitment', | ||
name='promo_media', | ||
field=models.CharField(blank=True, default=None, help_text='Youtube video id', max_length=11, null=True), | ||
), | ||
] |
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
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,78 @@ | ||
@use 'sass:color'; | ||
|
||
/* stylelint-disable-next-line no-invalid-position-at-import-rule */ | ||
@import 'src/constants'; | ||
|
||
/* stylelint-disable-next-line no-invalid-position-at-import-rule */ | ||
@import 'src/mixins'; | ||
|
||
.container { | ||
position: relative; | ||
width: 260px; | ||
} | ||
|
||
.button { | ||
@include rounded-lighter; | ||
display: flex; | ||
gap: 0.25rem; | ||
align-items: center; | ||
width: 100%; | ||
justify-content: flex-start; | ||
font-size: 0.875rem; | ||
padding: 0.75rem 2.5rem 0.75rem 1rem; | ||
color: $black; | ||
cursor: pointer; | ||
margin-top: 0.5em; // Make sure this is the same for all inputs that should be used together | ||
border: 1px solid $grey-35; | ||
background-color: $white; | ||
font-weight: initial; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); | ||
transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1); | ||
|
||
&:hover { | ||
background-color: $grey-4; | ||
} | ||
|
||
&:focus { | ||
border-color: $grey-3; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); | ||
outline: 1px solid rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
@include theme-dark { | ||
background-color: $theme-dark-input-bg; | ||
color: white; | ||
border-color: $grey-0; | ||
&:focus { | ||
border-color: $grey-1; | ||
outline: 1px solid rgba(255, 255, 255, 0.6); | ||
} | ||
&:hover { | ||
background-color: color.scale($theme-dark-input-bg, $lightness: 8%); | ||
} | ||
} | ||
} | ||
|
||
.popover { | ||
position: absolute; | ||
left: 0; | ||
top: 100%; | ||
margin-top: 4px; | ||
padding: 0.25rem; | ||
background: $white; | ||
border-radius: 0.5rem; | ||
z-index: 100; | ||
//box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); | ||
box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.1); | ||
//box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px; | ||
border: 1px solid $grey-35; | ||
|
||
@include theme-dark { | ||
background: $black-1; | ||
border-color: $grey-0; | ||
} | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} |
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,20 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { DatePicker } from './DatePicker'; | ||
|
||
// Local component config. | ||
const meta = { | ||
title: 'Components/DatePicker', | ||
component: DatePicker, | ||
} satisfies Meta<typeof DatePicker>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const onChange = (value: unknown) => console.log('Selected:', value); | ||
|
||
export const Basic: Story = { | ||
args: { | ||
onChange, | ||
}, | ||
}; |
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,76 @@ | ||
import { Icon } from '@iconify/react'; | ||
import classNames from 'classnames'; | ||
import { format } from 'date-fns'; | ||
import React, { useMemo } from 'react'; | ||
import { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Button, MiniCalendar } from '~/Components'; | ||
import { useClickOutside } from '~/hooks'; | ||
import { KEY } from '~/i18n/constants'; | ||
import styles from './DatePicker.module.scss'; | ||
|
||
type DatePickerProps = { | ||
label?: string; | ||
disabled?: boolean; | ||
value?: Date | null; | ||
buttonClassName?: string; | ||
onChange?: (date: Date | null) => void; | ||
className?: string; | ||
|
||
minDate?: Date; | ||
maxDate?: Date; | ||
}; | ||
|
||
export function DatePicker({ | ||
value: initialValue, | ||
onChange, | ||
disabled, | ||
label, | ||
buttonClassName, | ||
minDate, | ||
maxDate, | ||
}: DatePickerProps) { | ||
const isControlled = initialValue !== undefined; | ||
|
||
const [date, setDate] = useState<Date | null>(null); | ||
const [open, setOpen] = useState(false); | ||
|
||
const { t } = useTranslation(); | ||
|
||
const clickOutsideRef = useClickOutside<HTMLDivElement>(() => setOpen(false)); | ||
|
||
const value = useMemo(() => { | ||
if (isControlled) { | ||
return initialValue; | ||
} | ||
return date; | ||
}, [isControlled, initialValue, date]); | ||
|
||
function handleChange(d: Date | null) { | ||
setDate(d); | ||
onChange?.(d); | ||
} | ||
|
||
return ( | ||
<div className={styles.container} ref={clickOutsideRef}> | ||
<button | ||
type="button" | ||
className={classNames(styles.button, buttonClassName)} | ||
onClick={() => setOpen((v) => !v)} | ||
disabled={disabled} | ||
> | ||
<Icon icon="material-symbols:calendar-month-outline-rounded" /> | ||
{value ? format(value, 'PPP') : <span>{label ?? t(KEY.pick_a_date)}</span>} | ||
</button> | ||
<div className={classNames(styles.popover, !open && styles.hidden)}> | ||
<MiniCalendar | ||
baseDate={value || new Date()} | ||
onChange={handleChange} | ||
minDate={minDate} | ||
maxDate={maxDate} | ||
displayLabel | ||
/> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { DatePicker } from './DatePicker'; |
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.