Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(mobile/note_icon): calculate number of columns dynamically
Elian Doranb090eb93599b
diff --git a/apps/client/src/widgets/note_icon.css b/apps/client/src/widgets/note_icon.cssindex 237f14076c..70e2f018de 100644--- a/apps/client/src/widgets/note_icon.css+++ b/apps/client/src/widgets/note_icon.css@@ -119,6 +119,14 @@ body.experimental-feature-new-layout {}body.mobile .modal.icon-switcher {+ .modal-dialog {+ left: 0;+ right: 0;+ margin: unset;+ transform: unset;+ max-width: 100%;+ }+.modal-body {padding: 0;diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsxindex 5ca80fa01d..96c26a8c6a 100644--- a/apps/client/src/widgets/note_icon.tsx+++ b/apps/client/src/widgets/note_icon.tsx@@ -18,7 +18,7 @@ import ActionButton from "./react/ActionButton";import Dropdown from "./react/Dropdown";import { FormDropdownDivider, FormListItem } from "./react/FormList";import FormTextBox from "./react/FormTextBox";-import { useNoteContext, useNoteLabel, useStaticTooltip } from "./react/hooks";+import { useNoteContext, useNoteLabel, useStaticTooltip, useWindowSize } from "./react/hooks";import Modal from "./react/Modal";interface IconToCountCache {@@ -65,6 +65,7 @@ function MobileNoteIconSwitcher({ note, icon }: {icon: string | null | undefined;}) {const [ modalShown, setModalShown ] = useState(false);+ const { windowWidth } = useWindowSize();return (<div className="note-icon-widget">@@ -82,7 +83,7 @@ function MobileNoteIconSwitcher({ note, icon }: {show={modalShown} onHidden={() => setModalShown(false)}className="icon-switcher note-icon-widget">- {note && <NoteIconList note={note} onHide={() => setModalShown(false)} columnCount={7} />}+ {note && <NoteIconList note={note} onHide={() => setModalShown(false)} columnCount={Math.floor(windowWidth / 48)} />}</Modal>), document.body)}</div>