Files
clg-kit/components/themed-text.tsx

65 lines
1.4 KiB
TypeScript

import { StyleSheet, Text, type TextProps } from 'react-native';
import { useThemeColor } from '@/hooks/use-theme-color';
export type ThemedTextProps = TextProps & {
lightColor?: string;
darkColor?: string;
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
};
export function ThemedText({
style,
lightColor,
darkColor,
type = 'default',
...rest
}: ThemedTextProps) {
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
return (
<Text
style={[
{ color },
type === 'default' ? styles.default : undefined,
type === 'title' ? styles.title : undefined,
type === 'defaultSemiBold' ? styles.defaultSemiBold : undefined,
type === 'subtitle' ? styles.subtitle : undefined,
type === 'link' ? styles.link : undefined,
style,
]}
{...rest}
/>
);
}
const styles = StyleSheet.create({
default: {
fontFamily: 'Manrope_400Regular',
fontSize: 15,
lineHeight: 22,
},
defaultSemiBold: {
fontFamily: 'Manrope_600SemiBold',
fontSize: 15,
lineHeight: 22,
},
title: {
fontFamily: 'Manrope_800ExtraBold',
fontSize: 32,
lineHeight: 38,
letterSpacing: -0.8,
},
subtitle: {
fontFamily: 'Manrope_700Bold',
fontSize: 20,
lineHeight: 26,
},
link: {
fontFamily: 'Manrope_600SemiBold',
lineHeight: 22,
fontSize: 15,
color: '#0559FA',
},
});