30 lines
956 B
TypeScript
30 lines
956 B
TypeScript
/*
|
|
* D-데이 칩 — 마감 역산(design.md §1-4). D-3 이내 warning, 초과 error.
|
|
*/
|
|
import React from 'react';
|
|
import { StyleSheet, Text, View } from 'react-native';
|
|
import { colors, radius, type } from '../theme';
|
|
|
|
export function DdayChip({ dday }: { dday: number }) {
|
|
const overdue = dday < 0;
|
|
const imminent = dday >= 0 && dday <= 3;
|
|
const bg = overdue ? colors.error : imminent ? colors.warning : colors.primary100;
|
|
const fg = overdue || imminent ? colors.white : colors.primary700;
|
|
const label = overdue ? `마감 +${Math.abs(dday)}` : `D-${dday}`;
|
|
return (
|
|
<View style={[styles.chip, { backgroundColor: bg }]}>
|
|
<Text style={[styles.text, { color: fg }]}>{label}</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
chip: {
|
|
alignSelf: 'flex-start',
|
|
paddingHorizontal: 10,
|
|
paddingVertical: 3,
|
|
borderRadius: radius.pill,
|
|
},
|
|
text: { fontSize: type.caption.fontSize, fontWeight: '700' },
|
|
});
|