feat: improve ChatAction ux

This commit is contained in:
Yidadaa
2023-08-02 22:53:36 +08:00
parent 531b3dcf9e
commit cbabb9392c
3 changed files with 21 additions and 2 deletions

View File

@@ -443,6 +443,7 @@ export function Selector<T>(props: {
subTitle?: string;
value: T;
}>;
defaultSelectedValue?: T;
onSelection?: (selection: T[]) => void;
onClose?: () => void;
multiple?: boolean;
@@ -452,6 +453,7 @@ export function Selector<T>(props: {
<div className={styles["selector-content"]}>
<List>
{props.items.map((item, i) => {
const selected = props.defaultSelectedValue === item.value;
return (
<ListItem
className={styles["selector-item"]}
@@ -462,7 +464,20 @@ export function Selector<T>(props: {
props.onSelection?.([item.value]);
props.onClose?.();
}}
></ListItem>
>
{selected ? (
<div
style={{
height: 10,
width: 10,
backgroundColor: "var(--primary)",
borderRadius: 10,
}}
></div>
) : (
<></>
)}
</ListItem>
);
})}
</List>