mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 07:39:39 +02:00
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>
46 lines
1.1 KiB
TypeScript
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>
|
|
);
|
|
};
|