feat(SW-1509): simplified date of birth component to work with new select

added animated labels to new select
This commit is contained in:
Christian Andolf
2025-04-14 10:56:17 +02:00
parent 57cd2f6a7f
commit e04342110a
4 changed files with 80 additions and 118 deletions

View File

@@ -15,6 +15,7 @@ import { SelectFilter } from './SelectFilter'
import type { SelectProps, SelectFilterProps } from './types'
import styles from './select.module.css'
import { useState } from 'react'
export function Select({
name,
@@ -25,6 +26,8 @@ export function Select({
itemIcon,
...props
}: SelectProps | SelectFilterProps) {
const [isOpen, setIsOpen] = useState(false)
if ('enableFiltering' in props) {
return (
<SelectFilter
@@ -45,6 +48,7 @@ export function Select({
name={name}
aria-label={label}
isDisabled={isDisabled}
onOpenChange={setIsOpen}
{...props}
>
<Button className={cx(styles.inner, styles.button)}>
@@ -62,18 +66,16 @@ export function Select({
<>
<Typography
variant={
selectedText
selectedText || isOpen
? 'Label/xsRegular'
: 'Body/Paragraph/mdRegular'
}
>
<span className={styles.label}>{label}</span>
</Typography>
{selectedText ? (
<Typography variant="Body/Paragraph/mdRegular">
<span>{selectedText}</span>
</Typography>
) : null}
<Typography variant="Body/Paragraph/mdRegular">
<span className={styles.selectedText}>{selectedText}</span>
</Typography>
</>
)
}}