feat: add mobile shell and unified search
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 50s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 20s
ci / .NET API 서버 테스트 (push) Successful in 12s
deploy-site / deploy (push) Successful in 39s
ci / 모바일 린트·타입·Jest (push) Failing after 3h10m31s
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 50s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 20s
ci / .NET API 서버 테스트 (push) Successful in 12s
deploy-site / deploy (push) Successful in 39s
ci / 모바일 린트·타입·Jest (push) Failing after 3h10m31s
This commit is contained in:
parent
f505a03d34
commit
5ca3709b32
98 changed files with 5168 additions and 2093 deletions
|
|
@ -1,184 +1,24 @@
|
|||
import type { ColorSchemeName } from 'react-native'
|
||||
import {
|
||||
getD3roNativePalette,
|
||||
type D3roNativePalette,
|
||||
} from '@d3ro/ui-native'
|
||||
|
||||
export type MobileThemeMode = 'system' | 'light' | 'dark'
|
||||
export type EffectiveMobileTheme = 'light' | 'dark'
|
||||
|
||||
/**
|
||||
* The mobile app and @d3ro/ui-native intentionally share one palette contract.
|
||||
* Keeping this alias prevents a second, drifting copy of the v4 theme.
|
||||
*/
|
||||
export type MobileThemePalette = D3roNativePalette
|
||||
|
||||
export const MOBILE_THEME_MODES: readonly MobileThemeMode[] = [
|
||||
'system',
|
||||
'light',
|
||||
'dark',
|
||||
] as const
|
||||
|
||||
export interface MobileThemePalette {
|
||||
bg: {
|
||||
app: string
|
||||
card: string
|
||||
cardHover: string
|
||||
elevated: string
|
||||
sidebar: string
|
||||
inset: string
|
||||
chassis: string
|
||||
}
|
||||
text: {
|
||||
primary: string
|
||||
white: string
|
||||
onAccent: string
|
||||
secondary: string
|
||||
label: string
|
||||
disabled: string
|
||||
inactive: string
|
||||
muted: string
|
||||
}
|
||||
accent: {
|
||||
main: string
|
||||
pressed: string
|
||||
dim: string
|
||||
glow: string
|
||||
green: string
|
||||
greenGlow: string
|
||||
}
|
||||
border: {
|
||||
subtle: string
|
||||
default: string
|
||||
strong: string
|
||||
}
|
||||
tag: {
|
||||
purple: string
|
||||
orange: string
|
||||
red: string
|
||||
green: string
|
||||
blue: string
|
||||
}
|
||||
/** v3: 시맨틱 상태 역할 (액센트와 분리) */
|
||||
status: {
|
||||
success: string
|
||||
successBg: string
|
||||
warning: string
|
||||
warningBg: string
|
||||
danger: string
|
||||
dangerBg: string
|
||||
info: string
|
||||
infoBg: string
|
||||
}
|
||||
/** v3: 모달 뒤 스크림 (테마 반응) */
|
||||
scrim: string
|
||||
led: {
|
||||
off: string
|
||||
}
|
||||
shadow: string
|
||||
}
|
||||
|
||||
const DARK_PALETTE: MobileThemePalette = {
|
||||
bg: {
|
||||
app: '#19191b',
|
||||
card: '#242427',
|
||||
cardHover: '#2a2a2d',
|
||||
elevated: '#2e2e32',
|
||||
sidebar: '#1e1f21',
|
||||
inset: '#0f0f11',
|
||||
chassis: '#242528',
|
||||
},
|
||||
text: {
|
||||
primary: '#f4f4f5',
|
||||
white: '#ffffff',
|
||||
onAccent: '#ffffff',
|
||||
secondary: '#b4b4bb',
|
||||
label: '#a1a1aa',
|
||||
disabled: '#5f6066',
|
||||
inactive: '#8d8e94',
|
||||
muted: '#9b9ba3',
|
||||
},
|
||||
accent: {
|
||||
// 브랜드 통일: 앱(Midnight Glass) blue 토큰과 동일 값
|
||||
main: '#3b82f6',
|
||||
pressed: '#2563eb',
|
||||
dim: 'rgba(59, 130, 246, 0.16)',
|
||||
glow: 'rgba(59, 130, 246, 0.5)',
|
||||
green: '#4ade80',
|
||||
greenGlow: 'rgba(74, 222, 128, 0.55)',
|
||||
},
|
||||
border: {
|
||||
subtle: 'rgba(255, 255, 255, 0.08)',
|
||||
default: '#3a3a40',
|
||||
strong: 'rgba(255, 255, 255, 0.22)',
|
||||
},
|
||||
tag: {
|
||||
purple: '#c084fc',
|
||||
orange: '#fbbf24',
|
||||
red: '#f87171',
|
||||
green: '#4ade80',
|
||||
blue: '#60a5fa',
|
||||
},
|
||||
status: {
|
||||
success: '#4ade80',
|
||||
successBg: 'rgba(74, 222, 128, 0.14)',
|
||||
warning: '#fbbf24',
|
||||
warningBg: 'rgba(251, 191, 36, 0.14)',
|
||||
danger: '#f87171',
|
||||
dangerBg: 'rgba(248, 113, 113, 0.14)',
|
||||
info: '#60a5fa',
|
||||
infoBg: 'rgba(96, 165, 250, 0.14)',
|
||||
},
|
||||
scrim: 'rgba(0, 0, 0, 0.6)',
|
||||
led: { off: '#111111' },
|
||||
shadow: '#000000',
|
||||
}
|
||||
|
||||
const LIGHT_PALETTE: MobileThemePalette = {
|
||||
bg: {
|
||||
app: '#f5f5f4',
|
||||
card: '#ffffff',
|
||||
cardHover: '#f1f1ef',
|
||||
elevated: '#ececea',
|
||||
sidebar: '#efefed',
|
||||
inset: '#e7e7e4',
|
||||
chassis: '#dededb',
|
||||
},
|
||||
text: {
|
||||
primary: '#1c1c1e',
|
||||
white: '#ffffff',
|
||||
onAccent: '#ffffff',
|
||||
secondary: '#45454b',
|
||||
label: '#55555d',
|
||||
disabled: '#99999f',
|
||||
inactive: '#6f6f76',
|
||||
muted: '#626269',
|
||||
},
|
||||
accent: {
|
||||
main: '#2563eb',
|
||||
pressed: '#1d4ed8',
|
||||
dim: 'rgba(37, 99, 235, 0.10)',
|
||||
glow: 'rgba(37, 99, 235, 0.24)',
|
||||
green: '#15803d',
|
||||
greenGlow: 'rgba(21, 128, 61, 0.22)',
|
||||
},
|
||||
border: {
|
||||
subtle: 'rgba(28, 28, 30, 0.10)',
|
||||
default: '#cececb',
|
||||
strong: 'rgba(28, 28, 30, 0.30)',
|
||||
},
|
||||
tag: {
|
||||
purple: '#7e22ce',
|
||||
orange: '#a25200',
|
||||
red: '#b42318',
|
||||
green: '#167044',
|
||||
blue: '#175cd3',
|
||||
},
|
||||
status: {
|
||||
success: '#15803d',
|
||||
successBg: 'rgba(21, 128, 61, 0.10)',
|
||||
warning: '#a25200',
|
||||
warningBg: 'rgba(162, 82, 0, 0.10)',
|
||||
danger: '#b42318',
|
||||
dangerBg: 'rgba(180, 35, 24, 0.10)',
|
||||
info: '#175cd3',
|
||||
infoBg: 'rgba(23, 92, 211, 0.10)',
|
||||
},
|
||||
scrim: 'rgba(0, 0, 0, 0.4)',
|
||||
led: { off: '#c6c6c2' },
|
||||
shadow: '#4b4b50',
|
||||
}
|
||||
|
||||
export function isMobileThemeMode(value: unknown): value is MobileThemeMode {
|
||||
return typeof value === 'string'
|
||||
&& (MOBILE_THEME_MODES as readonly string[]).includes(value)
|
||||
|
|
@ -195,5 +35,5 @@ export function resolveEffectiveTheme(
|
|||
export function getMobileThemePalette(
|
||||
effectiveTheme: EffectiveMobileTheme,
|
||||
): MobileThemePalette {
|
||||
return effectiveTheme === 'light' ? LIGHT_PALETTE : DARK_PALETTE
|
||||
return getD3roNativePalette(effectiveTheme)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,20 @@ import {
|
|||
type ViewProps,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import { d3roNativeFonts, d3roNativeRadius, d3roNativeTypo, type D3roNativeTypoKey } from '@d3ro/ui-native'
|
||||
import {
|
||||
d3roNativeControl,
|
||||
d3roNativeFonts,
|
||||
d3roNativeRadius,
|
||||
d3roNativeTypo,
|
||||
type D3roNativePalette,
|
||||
type D3roNativeTypoKey,
|
||||
} from '@d3ro/ui-native'
|
||||
import { useMobilePreferences } from '../lib/preferences-context'
|
||||
|
||||
type ThemeTextColor =
|
||||
| 'primary'
|
||||
| 'secondary'
|
||||
| 'tertiary'
|
||||
| 'muted'
|
||||
| 'accent'
|
||||
| 'success'
|
||||
|
|
@ -38,11 +46,12 @@ export function ThemeText({
|
|||
const resolvedColor: Record<ThemeTextColor, string> = {
|
||||
primary: palette.text.primary,
|
||||
secondary: palette.text.secondary,
|
||||
muted: palette.text.muted,
|
||||
accent: palette.accent.main,
|
||||
success: palette.tag.green,
|
||||
danger: palette.tag.red,
|
||||
onAccent: palette.text.onAccent,
|
||||
tertiary: palette.text.tertiary,
|
||||
muted: palette.text.tertiary,
|
||||
accent: palette.accent.light,
|
||||
success: palette.status?.success ?? palette.tag.green,
|
||||
danger: palette.status?.danger ?? palette.tag.red,
|
||||
onAccent: palette.accent.ink,
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -82,16 +91,10 @@ export function ThemeCard({
|
|||
style={[
|
||||
{
|
||||
backgroundColor: inset ? palette.bg.inset : palette.bg.card,
|
||||
borderColor: palette.border.subtle,
|
||||
borderWidth: inset ? 0 : 1,
|
||||
// 카드 반경은 SSOT 토큰 사용
|
||||
borderColor: inset ? palette.border.subtle : palette.border.default,
|
||||
borderWidth: 1,
|
||||
borderRadius: inset ? d3roNativeRadius.inner : d3roNativeRadius.card,
|
||||
padding: inset ? 10 : 16,
|
||||
shadowColor: palette.shadow,
|
||||
shadowOffset: { width: 0, height: 4 },
|
||||
shadowOpacity: inset ? 0 : 0.12,
|
||||
shadowRadius: inset ? 0 : 8,
|
||||
elevation: inset ? 0 : 2,
|
||||
padding: inset ? 12 : 16,
|
||||
},
|
||||
style,
|
||||
]}
|
||||
|
|
@ -108,6 +111,49 @@ interface ThemeButtonProps extends Omit<PressableProps, 'children' | 'style'> {
|
|||
textStyle?: StyleProp<TextStyle>
|
||||
}
|
||||
|
||||
interface ThemeButtonTone {
|
||||
background: string
|
||||
pressed: string
|
||||
border: string
|
||||
text: ThemeTextColor
|
||||
}
|
||||
|
||||
export function resolveThemeButtonTone(
|
||||
palette: D3roNativePalette,
|
||||
variant: NonNullable<ThemeButtonProps['variant']>,
|
||||
): ThemeButtonTone {
|
||||
switch (variant) {
|
||||
case 'primary':
|
||||
return {
|
||||
background: palette.accent.solid,
|
||||
pressed: palette.accent.solidHover,
|
||||
border: palette.accent.solid,
|
||||
text: 'onAccent',
|
||||
}
|
||||
case 'danger':
|
||||
return {
|
||||
background: 'transparent',
|
||||
pressed: palette.status.dangerBg,
|
||||
border: palette.border.strong,
|
||||
text: 'danger',
|
||||
}
|
||||
case 'quiet':
|
||||
return {
|
||||
background: 'transparent',
|
||||
pressed: palette.overlay.soft,
|
||||
border: 'transparent',
|
||||
text: 'secondary',
|
||||
}
|
||||
case 'secondary':
|
||||
return {
|
||||
background: 'transparent',
|
||||
pressed: palette.overlay.soft,
|
||||
border: palette.border.strong,
|
||||
text: 'primary',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function ThemeButton({
|
||||
label,
|
||||
variant = 'primary',
|
||||
|
|
@ -117,51 +163,38 @@ export function ThemeButton({
|
|||
...pressableProps
|
||||
}: ThemeButtonProps): React.ReactElement {
|
||||
const { palette } = useMobilePreferences()
|
||||
const primary = variant === 'primary'
|
||||
const danger = variant === 'danger'
|
||||
const quiet = variant === 'quiet'
|
||||
const backgroundColor = primary
|
||||
? palette.accent.main
|
||||
: danger
|
||||
? palette.tag.red
|
||||
: 'transparent'
|
||||
const borderColor = quiet
|
||||
? 'transparent'
|
||||
: primary
|
||||
? palette.accent.main
|
||||
: danger
|
||||
? palette.tag.red
|
||||
: palette.border.strong
|
||||
const tone = resolveThemeButtonTone(palette, variant)
|
||||
const isDisabled = disabled === true
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
{...pressableProps}
|
||||
accessibilityRole={pressableProps.accessibilityRole ?? 'button'}
|
||||
disabled={disabled}
|
||||
accessibilityState={{
|
||||
...pressableProps.accessibilityState,
|
||||
disabled: isDisabled,
|
||||
}}
|
||||
disabled={isDisabled}
|
||||
style={({ pressed }) => [
|
||||
{
|
||||
minHeight: 48,
|
||||
minHeight: d3roNativeControl.h,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: 18,
|
||||
paddingHorizontal: d3roNativeControl.padX,
|
||||
paddingVertical: 12,
|
||||
borderRadius: d3roNativeRadius.button,
|
||||
borderWidth: quiet ? 0 : 1,
|
||||
borderColor,
|
||||
backgroundColor: pressed && primary
|
||||
? palette.accent.pressed
|
||||
: pressed && !primary
|
||||
? palette.bg.cardHover
|
||||
: backgroundColor,
|
||||
opacity: disabled ? 0.48 : 1,
|
||||
borderWidth: 1,
|
||||
borderColor: tone.border,
|
||||
backgroundColor: pressed && !isDisabled ? tone.pressed : tone.background,
|
||||
opacity: isDisabled ? 0.5 : 1,
|
||||
},
|
||||
style,
|
||||
]}
|
||||
>
|
||||
<ThemeText
|
||||
variant="small"
|
||||
color={primary || danger ? 'onAccent' : quiet ? 'muted' : 'primary'}
|
||||
style={[{ textAlign: 'center' }, textStyle]}
|
||||
color={tone.text}
|
||||
style={[{ textAlign: 'center', fontWeight: '500' }, textStyle]}
|
||||
>
|
||||
{label}
|
||||
</ThemeText>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue