review dropdown lolo

This commit is contained in:
Max S 2024-07-26 16:24:05 +02:00
parent 30af203045
commit d777d15db6
4 changed files with 77 additions and 48 deletions

View File

@ -1,11 +1,15 @@
@import "@Themes/constants.scss"; @import "@Themes/constants.scss";
.root { .root {
.label {
padding: 0px var(--spacing-2, 16px);
}
.container {
cursor: pointer; cursor: pointer;
height: 56px;
display: flex; display: flex;
align-items: center; align-items: center;
height: 56px;
padding: var(--spacing-2, 16px) var(--spacing-sm, 8px); padding: var(--spacing-2, 16px) var(--spacing-sm, 8px);
gap: var(--spacing-2, 16px); gap: var(--spacing-2, 16px);
@ -15,6 +19,12 @@
background: var(--dropdown-input-background, #fff); background: var(--dropdown-input-background, #fff);
.content { .content {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
height: 24px;
.value {
width: 100%; width: 100%;
display: flex; display: flex;
padding: 0px var(--spacing-2, 16px); padding: 0px var(--spacing-2, 16px);
@ -22,6 +32,14 @@
flex: 1 0 0; flex: 1 0 0;
} }
svg {
width: 24px;
height: 24px;
cursor: pointer;
stroke: var(--button-icon-button-default-default);
}
}
&:hover { &:hover {
border-color: var(--dropdown-input-border-hovered); border-color: var(--dropdown-input-border-hovered);
} }
@ -43,3 +61,4 @@
pointer-events: none; pointer-events: none;
} }
} }
}

View File

@ -3,7 +3,6 @@ import { ChevronDownIcon } from "@heroicons/react/24/outline";
import classNames from "classnames"; import classNames from "classnames";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import IconButton from "../IconButton";
import Typography, { ETypo, ETypoColor } from "../Typography"; import Typography, { ETypo, ETypoColor } from "../Typography";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import DropdownMenu from "./DropdownMenu"; import DropdownMenu from "./DropdownMenu";
@ -11,6 +10,7 @@ import { IOption } from "./DropdownMenu/DropdownOption";
type IProps = { type IProps = {
options: IOption[]; options: IOption[];
label?: string;
placeholder?: string; placeholder?: string;
disabled?: boolean; disabled?: boolean;
onSelect?: (option: IOption) => void; onSelect?: (option: IOption) => void;
@ -36,9 +36,15 @@ export default function Dropdown(props: IProps) {
return ( return (
<DropdownMenu options={options} openable={openable} onSelect={handleOnSelect} selectedOption={selectedOption}> <DropdownMenu options={options} openable={openable} onSelect={handleOnSelect} selectedOption={selectedOption}>
<div className={classes["root"]}>
{props.label && (
<Typography className={classes["label"]} typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.CONTRAST_DEFAULT}>
{props.label}
</Typography>
)}
<div <div
className={classNames([ className={classNames([
classes["root"], classes["container"],
openable.isOpen && classes["open"], openable.isOpen && classes["open"],
disabled && classes["disabled"], disabled && classes["disabled"],
!!selectedOption && classes["active"], !!selectedOption && classes["active"],
@ -46,12 +52,14 @@ export default function Dropdown(props: IProps) {
onClick={openable.toggle}> onClick={openable.toggle}>
<div className={classes["content"]}> <div className={classes["content"]}>
<Typography <Typography
typo={ETypo.TEXT_MD_REGULAR} className={classes["value"]}
typo={!!selectedOption ? ETypo.TEXT_MD_SEMIBOLD : ETypo.TEXT_MD_REGULAR}
color={!!selectedOption ? ETypoColor.DROPDOWN_CONTRAST_ACTIVE : ETypoColor.DROPDOWN_CONTRAST_DEFAULT}> color={!!selectedOption ? ETypoColor.DROPDOWN_CONTRAST_ACTIVE : ETypoColor.DROPDOWN_CONTRAST_DEFAULT}>
{getLabel(selectedOption) ?? placeholder} {getLabel(selectedOption) ?? placeholder}
</Typography> </Typography>
<ChevronDownIcon />
</div>
</div> </div>
<IconButton icon={<ChevronDownIcon />} />
</div> </div>
</DropdownMenu> </DropdownMenu>
); );

View File

@ -41,6 +41,7 @@
.input-container { .input-container {
display: flex; display: flex;
align-items: center;
flex: 1; flex: 1;
gap: 8px; gap: 8px;
padding: 0px var(--spacing-2, 16px); padding: 0px var(--spacing-2, 16px);

View File

@ -127,6 +127,7 @@ export default function DesignSystem() {
}, },
]} ]}
placeholder="Placeholder" placeholder="Placeholder"
label="Label"
/> />
<Typography typo={ETypo.TEXT_LG_BOLD}>Navigation latérale</Typography> <Typography typo={ETypo.TEXT_LG_BOLD}>Navigation latérale</Typography>
<SearchBlockList <SearchBlockList