Skip to content

Build your personal knowledge base with Trilium Notes

feat(icon_picker): fade the icon grid under the search row

Elian Dorand787f4567f4c
diff --git a/apps/client/src/widgets/note_icon.css b/apps/client/src/widgets/note_icon.css
index 4e509acd10..cb9ebe3dab 100644
--- a/apps/client/src/widgets/note_icon.css
+++ b/apps/client/src/widgets/note_icon.css
@@ -50,7 +50,7 @@ div.note-icon-widget {
overflow: clip;
.filter-row {
- padding: 10px 15px;
+ padding: 10px 15px 0;
}
}
@@ -112,6 +112,7 @@ body.mobile .modal.icon-switcher {
}
.icon-list {
+ --scroll-fade-top: 0px;
margin: auto;
flex-grow: 1;
height: 100%;
diff --git a/apps/client/src/widgets/react/IconPicker.css b/apps/client/src/widgets/react/IconPicker.css
index 553c3ffdb6..de2478b517 100644
--- a/apps/client/src/widgets/react/IconPicker.css
+++ b/apps/client/src/widgets/react/IconPicker.css
@@ -21,6 +21,7 @@
* leaves room for the search row above the grid, the panel's padding, and the toggle.
*/
.icon-picker .icon-list {
+ --scroll-fade-top: 20px;
height: clamp(12rem, 100vh - 8rem, 500px);
overflow: auto;
}
@@ -31,6 +32,8 @@
cursor: pointer;
border: 1px solid transparent;
font-size: 180%;
+ /* Keeps the first row clear of the `.scroll-edge-fade` mask while the grid is at the top. */
+ top: var(--scroll-fade-top);
}
.icon-picker .icon-list span:hover {
@@ -38,7 +41,7 @@
}
.icon-picker.compact .filter-row {
- padding: 6px;
+ padding: 6px 6px 0;
gap: 0.5em;
font-size: 0.85em;
}
@@ -49,6 +52,10 @@
}
/* The glyph, its padding and its border have to stay inside `COMPACT_ICON_SIZE` in IconPicker.tsx. */
+.icon-picker.compact .icon-list {
+ --scroll-fade-top: 12px;
+}
+
.icon-picker.compact .icon-list span {
padding: 6px;
font-size: 24px;
diff --git a/apps/client/src/widgets/react/IconPicker.tsx b/apps/client/src/widgets/react/IconPicker.tsx
index e3f3d4e674..24d73d9742 100644
--- a/apps/client/src/widgets/react/IconPicker.tsx
+++ b/apps/client/src/widgets/react/IconPicker.tsx
@@ -105,6 +105,7 @@ export default function IconPicker({ onSelect, onReset, resetText, columnCount,
>
{filteredIcons.length ? (
<Grid
+ className="scroll-edge-fade"
columnCount={columnCount}
columnWidth={iconSize}
rowCount={Math.ceil(filteredIcons.length / columnCount)}