feat(note_bars): view type switcher

This commit is contained in:
Elian Doran
2025-12-11 18:53:48 +02:00
parent 0856d3dbdf
commit 0eed72b888
4 changed files with 67 additions and 65 deletions

View File

@@ -0,0 +1,29 @@
import FNote from "../../entities/fnote";
import { ViewTypeOptions } from "../collections/interface";
import Dropdown from "../react/Dropdown";
import { FormListItem } from "../react/FormList";
import { useViewType, VIEW_TYPE_MAPPINGS } from "../ribbon/CollectionPropertiesTab";
export default function CollectionProperties({ note }: { note: FNote }) {
return (
<ViewTypeSwitcher note={note} />
);
}
function ViewTypeSwitcher({ note }: { note: FNote }) {
const [ viewType, setViewType ] = useViewType(note);
return (
<Dropdown
text={VIEW_TYPE_MAPPINGS[viewType as ViewTypeOptions ?? "grid"]}
>
{Object.entries(VIEW_TYPE_MAPPINGS).map(([ key, label ]) => (
<FormListItem
key={key}
onClick={() => setViewType(key)}
checked={viewType === key}
>{label}</FormListItem>
))}
</Dropdown>
);
}