Skip to content

Commit a1691d3

Browse files
authored
fix: update sizes for navigation rail items (#452)
Follow-up to #442 . The items feel a bit too large so opted to reduce the size of the icons and adjust some of the padding around each of them.
1 parent 351229e commit a1691d3

1 file changed

Lines changed: 36 additions & 10 deletions

File tree

src/renderer/src/routes/app/route.tsx

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { BLUE_GREY, COMAPEO_BLUE, DARK_GREY, WHITE } from '../../colors'
1616
import { Icon } from '../../components/icon'
1717
import { ButtonLink, type ButtonLinkProps } from '../../components/link'
1818
import { useGlobalEditingState } from '../../contexts/global-editing-state-store-context'
19+
import { useIconSizeBasedOnTypography } from '../../hooks/icon.ts'
1920
import {
2021
COMAPEO_CORE_REACT_ROOT_QUERY_KEY,
2122
COORDINATOR_ROLE_ID,
@@ -142,6 +143,14 @@ function RouteComponent() {
142143
const someGlobalMutationIsPending =
143144
useIsMutating({ mutationKey: GLOBAL_MUTATIONS_BASE_KEY }) > 0
144145

146+
const labeledNavIconSize = useIconSizeBasedOnTypography({
147+
typographyVariant: 'body1',
148+
})
149+
const unlabledNavIconSize = useIconSizeBasedOnTypography({
150+
typographyVariant: 'body1',
151+
multiplier: 1.2,
152+
})
153+
145154
return (
146155
<Box bgcolor={WHITE} height="100%">
147156
<Box display="grid" gridTemplateColumns="min-content 1fr" height="100%">
@@ -191,6 +200,7 @@ function RouteComponent() {
191200
fullWidth
192201
variant="text"
193202
color="inherit"
203+
size="small"
194204
inactiveProps={BASE_INACTIVE_LINK_PROPS}
195205
activeProps={
196206
// NOTE: Subroutes of the project that also live as nav rail tabs
@@ -215,7 +225,10 @@ function RouteComponent() {
215225
paddingBlock={4}
216226
flex={1}
217227
>
218-
<Icon name="noun-project-notebook" size={32} />
228+
<Icon
229+
name="noun-project-notebook"
230+
size={unlabledNavIconSize}
231+
/>
219232
</Box>
220233
</ButtonLink>
221234
</ListItem>
@@ -245,6 +258,7 @@ function RouteComponent() {
245258
fullWidth
246259
variant="text"
247260
color="inherit"
261+
size="small"
248262
inactiveProps={BASE_INACTIVE_LINK_PROPS}
249263
activeProps={BASE_ACTIVE_LINK_PROPS}
250264
aria-label={t(m.exchangeTabAccessibleLabel)}
@@ -256,7 +270,10 @@ function RouteComponent() {
256270
paddingBlock={4}
257271
flex={1}
258272
>
259-
<Icon name="material-offline-bolt-filled" size={36} />
273+
<Icon
274+
name="material-offline-bolt-filled"
275+
size={unlabledNavIconSize}
276+
/>
260277
</Box>
261278
</ButtonLink>
262279
</ListItem>
@@ -291,6 +308,7 @@ function RouteComponent() {
291308
fullWidth
292309
variant="text"
293310
color="inherit"
311+
size="small"
294312
inactiveProps={BASE_INACTIVE_LINK_PROPS}
295313
activeProps={BASE_ACTIVE_LINK_PROPS}
296314
>
@@ -299,9 +317,12 @@ function RouteComponent() {
299317
alignItems="center"
300318
flexWrap="wrap"
301319
textAlign="center"
302-
gap={2}
320+
gap={1}
303321
>
304-
<Icon name="material-people-filled" size={36} />
322+
<Icon
323+
name="material-people-filled"
324+
size={labeledNavIconSize}
325+
/>
305326

306327
{t(m.teamTabLabel)}
307328
</Stack>
@@ -337,6 +358,7 @@ function RouteComponent() {
337358
fullWidth
338359
variant="text"
339360
color="inherit"
361+
size="small"
340362
inactiveProps={BASE_INACTIVE_LINK_PROPS}
341363
activeProps={BASE_ACTIVE_LINK_PROPS}
342364
>
@@ -345,9 +367,12 @@ function RouteComponent() {
345367
alignItems="center"
346368
flexWrap="wrap"
347369
textAlign="center"
348-
gap={2}
370+
gap={1}
349371
>
350-
<Icon name="material-manage-accounts-filled" size={36} />
372+
<Icon
373+
name="material-manage-accounts-filled"
374+
size={labeledNavIconSize}
375+
/>
351376

352377
{t(m.toolsTabLabel)}
353378
</Stack>
@@ -380,6 +405,7 @@ function RouteComponent() {
380405
fullWidth
381406
variant="text"
382407
color="inherit"
408+
size="small"
383409
inactiveProps={BASE_INACTIVE_LINK_PROPS}
384410
activeProps={BASE_ACTIVE_LINK_PROPS}
385411
>
@@ -388,9 +414,9 @@ function RouteComponent() {
388414
alignItems="center"
389415
flexWrap="wrap"
390416
textAlign="center"
391-
gap={2}
417+
gap={1}
392418
>
393-
<Icon name="material-settings" size={32} />
419+
<Icon name="material-settings" size={labeledNavIconSize} />
394420

395421
{t(m.appSettingsTabLabel)}
396422
</Stack>
@@ -410,15 +436,15 @@ function RouteComponent() {
410436

411437
const BASE_INACTIVE_LINK_PROPS = {
412438
sx: {
413-
padding: 2,
439+
padding: 1,
414440
borderRadius: 2,
415441
color: DARK_GREY,
416442
},
417443
} satisfies ButtonLinkProps['inactiveProps']
418444

419445
const BASE_ACTIVE_LINK_PROPS = {
420446
sx: {
421-
padding: 2,
447+
padding: 1,
422448
borderRadius: 2,
423449
color: COMAPEO_BLUE,
424450
background: (theme) => theme.lighten(theme.palette.primary.light, 0.5),

0 commit comments

Comments
 (0)