Skip to content

refactor: modernize non standard components to the latest MD3 spec#5016

Open
MrMuzyk wants to merge 3 commits into
callstack:mainfrom
MrMuzyk:refactor/non-standard-components
Open

refactor: modernize non standard components to the latest MD3 spec#5016
MrMuzyk wants to merge 3 commits into
callstack:mainfrom
MrMuzyk:refactor/non-standard-components

Conversation

@MrMuzyk

@MrMuzyk MrMuzyk commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

Modernizes the remaining non-standard components — Avatar, Banner, and DataTable — to the latest MD3 spec by adopting the recently added theme tokens (shape, motion, typography, colors).

Changes

Avatar (AvatarIcon, AvatarText, AvatarImage, new utils.ts)

  • Colors: default primary + getContrastingColor(white) → MD3 container pair primaryContainer / onPrimaryContainer. Custom backgrounds keep the getContrastingColor
  • luminance fallback (arbitrary per-user colors have no on- role).
  • Shape: borderRadius: size / 2 → cornerFull (9999) from src/theme/tokens/sys/shape.
  • Typography: AvatarText spreads theme.fonts.titleMedium (family/weight/letterSpacing) before its proportional fontSize/lineHeight.
  • Structure: new src/components/Avatar/utils.ts (DEFAULT_SIZE = 64, ICON_SIZE_RATIO = 0.6, resolveAvatarColors) shared by the three files; removes the duplicated
  • defaultSize constant.

Banner (Banner.tsx)

  • Motion: durations 250 * scale / 200 * scale → theme.motion.duration.medium1 / short4 (values unchanged), plus easing: Easing.bezier(...theme.motion.easing.standard). Dropped the legacy * scale multiplier to match how Switch/Checkbox adopted motion tokens.
  • Icon size: size={40} → const ICON_SIZE = 40.

DataTable (DataTableTitle, DataTableCell, DataTablePagination)

  • Typography: header → variant="labelMedium" (keeps 12px; lineHeight: 24 retained to stay vertically aligned with the 24dp sort icon); cell → variant="bodyMedium"; pagination labels → variant="bodySmall".
  • Motion: sort-arrow spin duration: 150 → theme.motion.duration.short3 (unchanged value) + easing.standard.

Visual / behavioral changes (no public API changed)

  • Avatar's default tone flips from solid primary + white content to the primaryContainer / onPrimaryContainer pair.
  • Banner & DataTable animations now use the MD3 standard easing curve (was RN's default ease-in-out); Banner no longer scales its duration by theme.animation.scale.
  • DataTable header gains MD3 label tracking (letterSpacing: 0.5).

Related issue

#4990

Test plan

  • yarn typescript
  • yarn lint
  • yarn test
  • Visual verification (yarn example web):
    • Avatar — Icon/Text/Image render circular with the new tonal default; custom-colored avatars stay legible
    • Banner — show/hide animates correctly via the FAB toggle
    • DataTable — column title sits vertically centered with the sort icon, cell/pagination text reads well, sort arrow still animates on header press
image
banner.mp4
image

@MrMuzyk MrMuzyk marked this pull request as ready for review June 30, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant