From 8dd41a4d5b1fcf59817fa478db40fac6ba13634c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 5 May 2026 15:02:25 +0000 Subject: [PATCH] Increase emoji picker cell size on mobile Mobile uses a 40px button with a 32px emoji glyph (vs. 32px / 24px on desktop), so roughly 8 emojis fit across a typical phone screen for easier touch targeting. https://claude.ai/code/session_017Rrv75Rc6eZ7eb2iNpZxpu --- .../IconPicker/components/GridTemplate.tsx | 23 +++++++++++++++---- .../IconPicker/components/IconButton.tsx | 7 +++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/components/IconPicker/components/GridTemplate.tsx b/app/components/IconPicker/components/GridTemplate.tsx index fa7bf655cb..dc284165b7 100644 --- a/app/components/IconPicker/components/GridTemplate.tsx +++ b/app/components/IconPicker/components/GridTemplate.tsx @@ -6,15 +6,21 @@ import { IconType } from "@shared/types"; import { IconLibrary } from "@shared/utils/IconLibrary"; import { Emoji } from "~/components/Emoji"; import Text from "~/components/Text"; +import useMobile from "~/hooks/useMobile"; import { TRANSLATED_CATEGORIES } from "../utils"; import Grid from "./Grid"; import { IconButton } from "./IconButton"; import { CustomEmoji } from "@shared/components/CustomEmoji"; /** - * icon/emoji size is 24px; and we add 4px padding on all sides, + * Desktop: 24px icon/emoji + 4px padding on all sides = 32px button. + * Mobile: 32px icon/emoji + 4px padding on all sides = 40px button, so + * roughly 8 emojis fit across a typical phone screen. */ -const BUTTON_SIZE = 32; +const BUTTON_SIZE_DESKTOP = 32; +const BUTTON_SIZE_MOBILE = 40; +const ICON_SIZE_DESKTOP = 24; +const ICON_SIZE_MOBILE = 32; type OutlineNode = { type: IconType.SVG; @@ -53,8 +59,11 @@ const GridTemplate = ( { width, height, data, empty, onIconSelect }: Props, ref: React.Ref ) => { + const isMobile = useMobile(); + const buttonSize = isMobile ? BUTTON_SIZE_MOBILE : BUTTON_SIZE_DESKTOP; + const iconSize = isMobile ? ICON_SIZE_MOBILE : ICON_SIZE_DESKTOP; // 24px padding for the Grid Container - const itemsPerRow = Math.floor((width - 24) / BUTTON_SIZE); + const itemsPerRow = Math.floor((width - 24) / buttonSize); const gridItems = compact( data.flatMap((node) => { @@ -96,7 +105,11 @@ const GridTemplate = ( key={item.id} onClick={() => onIconSelect({ id: item.id, value: item.value })} > - + {item.type === IconType.Custom ? ( ) : ( @@ -119,7 +132,7 @@ const GridTemplate = ( height={height} data={gridItems} columns={itemsPerRow} - itemWidth={BUTTON_SIZE} + itemWidth={buttonSize} /> ); }; diff --git a/app/components/IconPicker/components/IconButton.tsx b/app/components/IconPicker/components/IconButton.tsx index ebc7e6a891..0f662f8724 100644 --- a/app/components/IconPicker/components/IconButton.tsx +++ b/app/components/IconPicker/components/IconButton.tsx @@ -1,5 +1,5 @@ import styled from "styled-components"; -import { s, hover } from "@shared/styles"; +import { breakpoints, s, hover } from "@shared/styles"; import NudeButton from "~/components/NudeButton"; export const IconButton = styled(NudeButton)<{ delay?: number }>` @@ -10,4 +10,9 @@ export const IconButton = styled(NudeButton)<{ delay?: number }>` &: ${hover} { background: ${s("listItemHoverBackground")}; } + + @media (max-width: ${breakpoints.tablet - 1}px) { + width: 40px; + height: 40px; + } `;