kintex/mobile/components/Button.tsx
zio 6c9891c7e2 feat: mobile harness + design v2.1 (84 screens) + PLANNING v3.1 + deliverables + Stitch screens
- Harness: kintex-mobile-dev agent + kintex-mobile-orchestrator skill (WISE mobile ref, Stitch-first design rule, dual app targets B2B/B2C)
- design.md v2.1: full 84-screen inventory (web 51 / admin 10 / public 8 / mobile 15) with Stitch prompts incl. ticketing (SCR-P7/P8, M14/M15)
- PLANNING v3.1: unified account + split signup tracks (2FA required for staff, light signup/guest for visitors), one codebase / two app targets
- Deliverables: dev plan (21s), user/operator/developer guides (17/14/15s), program spec (44s, 65 programs, 8 flowcharts), DA (DB design 14s + table spec xlsx 35 tables/299 cols)
- Benchmark: ticketing-app-benchmark.md (7 apps) -> IMPLEMENTATION_BACKLOG Phase F (14 items)
- Stitch: 23 generated screens saved (mobile 10, admin 6, web core 5, ticket 2)
- mobile/: Expo scaffold (SDK 51, expo-router, secure store JWT)
- frontend: SCR-13~17 QA fixes, icons.tsx, kintexEvents, V10 seed migration
- ci/: KINTEX CI logo assets

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 23:31:45 +09:00

96 lines
2.2 KiB
TypeScript

/*
* 기본 버튼 — 48px 터치 타깃(design.md §1-3), radius 4(sm).
* variant: primary(브랜드 블루) · ai(보라) · outline · success · danger · ghost.
*/
import React from 'react';
import {
ActivityIndicator,
Pressable,
StyleSheet,
Text,
View,
type StyleProp,
type ViewStyle,
} from 'react-native';
import { colors, radius, touch, type } from '../theme';
type Variant = 'primary' | 'ai' | 'outline' | 'success' | 'danger' | 'ghost';
interface Props {
label: string;
onPress?: () => void;
variant?: Variant;
disabled?: boolean;
loading?: boolean;
style?: StyleProp<ViewStyle>;
icon?: React.ReactNode;
}
const bg: Record<Variant, string> = {
primary: colors.primary600,
ai: colors.aiAccent,
outline: 'transparent',
success: colors.success,
danger: colors.error,
ghost: 'transparent',
};
const fg: Record<Variant, string> = {
primary: colors.white,
ai: colors.white,
outline: colors.primary600,
success: colors.white,
danger: colors.white,
ghost: colors.neutral700,
};
export function Button({
label,
onPress,
variant = 'primary',
disabled,
loading,
style,
icon,
}: Props) {
const isDisabled = disabled || loading;
return (
<Pressable
accessibilityRole="button"
accessibilityState={{ disabled: !!isDisabled, busy: !!loading }}
onPress={isDisabled ? undefined : onPress}
style={({ pressed }) => [
styles.base,
{
backgroundColor: bg[variant],
borderColor: variant === 'outline' ? colors.primary600 : 'transparent',
borderWidth: variant === 'outline' ? 1 : 0,
opacity: isDisabled ? 0.5 : pressed ? 0.85 : 1,
},
style,
]}
>
{loading ? (
<ActivityIndicator color={fg[variant]} />
) : (
<View style={styles.row}>
{icon}
<Text style={[styles.label, { color: fg[variant] }]}>{label}</Text>
</View>
)}
</Pressable>
);
}
const styles = StyleSheet.create({
base: {
minHeight: touch.min,
borderRadius: radius.sm,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 16,
},
row: { flexDirection: 'row', alignItems: 'center', gap: 8 },
label: { fontSize: type.h3.fontSize, fontWeight: '600' },
});