managarten/manadeck/apps/mobile/components/ui/Text.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

46 lines
1.1 KiB
TypeScript

import React from 'react';
import { Text as RNText, TextProps as RNTextProps } from 'react-native';
type TextVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'body' | 'caption' | 'small';
interface TextProps extends RNTextProps {
variant?: TextVariant;
className?: string;
}
const getVariantClasses = (variant: TextVariant): string => {
switch (variant) {
case 'h1':
return 'text-4xl font-bold';
case 'h2':
return 'text-3xl font-bold';
case 'h3':
return 'text-2xl font-semibold';
case 'h4':
return 'text-xl font-semibold';
case 'body':
return 'text-base';
case 'caption':
return 'text-sm';
case 'small':
return 'text-xs';
default:
return 'text-base';
}
};
export const Text: React.FC<TextProps> = ({
variant = 'body',
className = '',
children,
...props
}) => {
const variantClasses = getVariantClasses(variant);
const combinedClassName = `${variantClasses} ${className}`.trim();
return (
<RNText className={combinedClassName} {...props}>
{children}
</RNText>
);
};