Make RN components fully theme-driven for multi-brand support

Refactor all 18 React Native components from static DTColors imports to
dynamic useDTTheme() context, enabling proper visual differentiation
when switching between DT and Classic brands.

Key changes:
- Replace static DTColors with theme context in all components
- Add shape tokens (bevel/radius) to DTExtendedTheme interface
- Conditionally render SVG bevels (DT) vs borderRadius (Classic)
- Configure fonts per brand (Tektur for DT, system sans-serif for Classic)
- Update buildThemeFromBrand to parse shape and typography tokens
- Fix Metro config for monorepo singleton resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
michael
2026-03-04 12:19:25 -08:00
parent 1b0d09313c
commit 47e8085581
23 changed files with 436 additions and 239 deletions

View File

@@ -8,16 +8,15 @@
// React import not needed with new JSX transform
import { StyleSheet, ViewStyle, StyleProp } from 'react-native';
import { Chip, ChipProps } from 'react-native-paper';
import { DTColors } from '../theme/colors';
type DTChipVariant = 'normal' | 'emphasis' | 'warning' | 'success' | 'other';
import { useDTTheme } from '../theme/DTThemeProvider';
import { type DTVariant, getVariantColor } from '../utils/variantColors';
interface DTChipProps extends Omit<ChipProps, 'mode'> {
/**
* Visual variant of the chip
* @default 'normal'
*/
variant?: DTChipVariant;
variant?: DTVariant;
/**
* Whether the chip is in selected state
* @default false
@@ -29,14 +28,6 @@ interface DTChipProps extends Omit<ChipProps, 'mode'> {
style?: StyleProp<ViewStyle>;
}
const variantColors: Record<DTChipVariant, string> = {
normal: DTColors.modeNormal,
emphasis: DTColors.modeEmphasis,
warning: DTColors.modeWarning,
success: DTColors.modeSuccess,
other: DTColors.modeOther,
};
/**
* DT-styled Chip component
*
@@ -56,7 +47,8 @@ export function DTChip({
children,
...props
}: DTChipProps) {
const color = variantColors[variant];
const theme = useDTTheme();
const color = getVariantColor(theme, variant);
const chipStyle: ViewStyle = {
backgroundColor: selected ? color : 'transparent',
@@ -71,7 +63,7 @@ export function DTChip({
mode="outlined"
textStyle={[
styles.text,
{ color: selected ? DTColors.dark : color },
{ color: selected ? theme.colors.onPrimary : color },
]}
style={[styles.chip, chipStyle, style]}
selectedColor={color}