Revert "feat: New notes list design (#780)"

This reverts commit 7dd4a60595.
This commit is contained in:
Karol Sójko
2022-01-05 16:11:34 +01:00
parent b57350c899
commit d76c636e54
20 changed files with 155 additions and 296 deletions

View File

@@ -13,7 +13,6 @@ import { useState } from 'preact/hooks';
export type DropdownItem = {
icon?: IconType;
iconClassName?: string;
label: string;
value: string;
};
@@ -26,7 +25,10 @@ type DropdownProps = {
onChange: (value: string) => void;
};
type ListboxButtonProps = DropdownItem & {
type ListboxButtonProps = {
icon?: IconType;
value: string | null;
label: string;
isExpanded: boolean;
};
@@ -34,13 +36,12 @@ const CustomDropdownButton: FunctionComponent<ListboxButtonProps> = ({
label,
isExpanded,
icon,
iconClassName = '',
}) => (
<>
<div className="sn-dropdown-button-label">
{icon ? (
<div className="flex mr-2">
<Icon type={icon} className={`sn-icon--small ${iconClassName}`} />
<Icon type={icon} className="sn-icon--small" />
</div>
) : null}
<div className="dropdown-selected-label">{label}</div>
@@ -84,13 +85,11 @@ export const Dropdown: FunctionComponent<DropdownProps> = ({
children={({ value, label, isExpanded }) => {
const current = items.find((item) => item.value === value);
const icon = current ? current?.icon : null;
const iconClassName = current ? current?.iconClassName : null;
return CustomDropdownButton({
value: value ? value : label.toLowerCase(),
value,
label,
isExpanded,
...(icon ? { icon } : null),
...(iconClassName ? { iconClassName } : null),
});
}}
/>
@@ -105,10 +104,7 @@ export const Dropdown: FunctionComponent<DropdownProps> = ({
>
{item.icon ? (
<div className="flex mr-3">
<Icon
type={item.icon}
className={`sn-icon--small ${item.iconClassName ?? ''}`}
/>
<Icon type={item.icon} className="sn-icon--small" />
</div>
) : null}
<div className="text-input">{item.label}</div>