refactor: centralise color maps, org color fallback, and motion-safe transitions
Create src/lib/theme-colors.ts with DOT_COLORS, KPI_COLORS, PROJECT_STATUS_COLORS, and DEFAULT_ORG_COLOR constants. Add motionSafeTransition() utility to src/lib/utils.ts. Removes 6 duplicate color map definitions across Card, DetailPanel, PatientSummaryTile, KPIDetail, ProjectsTile, and ProjectDetail. Replaces 9 hardcoded '#0D6E6E' fallbacks and 7 inline motion ternaries. Fixes project status color inconsistency between ProjectsTile and ProjectDetail (Ongoing was teal in tile, amber in detail).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { motion, AnimatePresence } from 'framer-motion'
|
||||
import type { TimelineEntity } from '@/types/pmr'
|
||||
import { prefersReducedMotion } from './constants'
|
||||
import { motionSafeTransition } from '@/lib/utils'
|
||||
|
||||
interface MobileAccordionProps {
|
||||
pinnedCareerEntity: TimelineEntity | null
|
||||
@@ -23,7 +23,7 @@ export const MobileAccordion: React.FC<MobileAccordionProps> = ({ pinnedCareerEn
|
||||
initial={{ height: 0 }}
|
||||
animate={{ height: 'auto' }}
|
||||
exit={{ height: 0 }}
|
||||
transition={prefersReducedMotion ? { duration: 0 } : { duration: 0.2, ease: 'easeOut' }}
|
||||
transition={motionSafeTransition(0.2)}
|
||||
style={{ overflow: 'hidden' }}
|
||||
>
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user