feat(SW-160): update profile

This commit is contained in:
Simon Emanuelsson
2024-07-17 16:12:18 +02:00
committed by Michael Zetterberg
parent b6e22d51a5
commit 2337d37f1a
32 changed files with 459 additions and 244 deletions
@@ -58,12 +58,14 @@ a.default {
align-items: center;
display: flex;
gap: var(--Spacing-x1);
justify-content: center;
}
.icon {
display: flex;
align-items: center;
display: flex;
gap: var(--Spacing-x-half);
justify-content: center;
}
/* SIZES */
@@ -798,4 +800,4 @@ a.default {
.icon.tertiaryLightSecondary:disabled svg,
.icon.tertiaryLightSecondary:disabled svg * {
fill: var(--Tertiary-Light-Button-Secondary-On-Fill-Disabled);
}
}
@@ -17,7 +17,6 @@ import type { Key } from "react-aria-components"
import type { DateProps } from "./date"
/** TODO: Get selecting with Enter-key to work */
export default function DateSelect({ name, registerOptions = {} }: DateProps) {
const { formatMessage } = useIntl()
const d = useWatch({ name })
@@ -54,6 +53,18 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) {
const monthLabel = formatMessage({ id: "Month" })
const yearLabel = formatMessage({ id: "Year" })
let dateValue = null
try {
/**
* parseDate throws when its not a valid
* date, but we can't check isNan since
* we recieve the date as "1999-01-01"
*/
dateValue = parseDate(d)
} catch (error) {
console.error(error)
}
return (
<DatePicker
aria-label={formatMessage({ id: "Select date of birth" })}
@@ -61,7 +72,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) {
isRequired={!!registerOptions.required}
name={name}
ref={field.ref}
value={isNaN(d) ? undefined : parseDate(d)}
value={dateValue}
>
<Group>
<DateInput className={styles.container}>
@@ -32,8 +32,8 @@ const config = {
defaultVariants: {
color: "burgundy",
textAlign: "left",
type: "h1",
textTransform: "uppercase",
type: "h1",
},
} as const