feat(react/dialog): port note_type_chooser

This commit is contained in:
Elian Doran
2025-08-06 11:39:31 +03:00
parent 2a40d6bb7e
commit 33e3112290
14 changed files with 238 additions and 214 deletions

View File

@@ -0,0 +1,49 @@
import { ComponentChildren } from "preact";
import Icon from "./Icon";
interface FormListOpts {
children: ComponentChildren;
onSelect?: (value: string) => void;
}
export default function FormList({ children, onSelect }: FormListOpts) {
return (
<div class="dropdown-menu static show" style={{
position: "relative"
}} onClick={(e) => {
const value = (e.target as HTMLElement)?.dataset?.value;
if (value && onSelect) {
onSelect(value);
}
}}>
{children}
</div>
);
}
interface FormListItemOpts {
text: string;
icon?: string;
value?: string;
}
export function FormListItem({ text, icon, value }: FormListItemOpts) {
return (
<a class="dropdown-item" data-value={value}>
<Icon icon={icon} />&nbsp;
{text}
</a>
);
}
interface FormListHeaderOpts {
text: string;
}
export function FormListHeader({ text }: FormListHeaderOpts) {
return (
<li>
<h6 className="dropdown-header">{text}</h6>
</li>
)
}