Finish cleaning up theme stuff

This commit is contained in:
2025-03-04 23:58:53 -06:00
parent 4775917db0
commit 4e93893319
14 changed files with 49 additions and 90 deletions

View File

@ -1,6 +1,6 @@
import React from 'react';
import { StyleSheet, Image, ImageProps, View } from 'react-native';
import { ThemedText } from '@/components/theme';
import ThemedText from '@/components/theme/default/ThemedText';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
@ -23,20 +23,20 @@ const ThemedAvatar: React.FC<ThemedAvatarProps> = ({
}) => {
const scheme = useColorScheme() ?? 'dark';
const border = borderColor || Colors[scheme].tint;
// Get initials from name
const getInitials = (name?: string) => {
if (!name) return '';
return name
.split(' ')
.map(part => part[0])
.map((part) => part[0])
.join('')
.toUpperCase()
.substring(0, 2);
};
const initials = getInitials(name);
return (
<View
style={[

View File

@ -1,6 +1,7 @@
import React from 'react';
import { StyleSheet, ViewProps } from 'react-native';
import { ThemedView, ThemedText } from '@/components/theme';
import ThemedText from '@/components/theme/default/ThemedText';
import ThemedView from '@/components/theme/default/ThemedView';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
@ -22,7 +23,7 @@ const ThemedBadge: React.FC<ThemedBadgeProps> = ({
const scheme = useColorScheme() ?? 'dark';
const badgeColor = color || Colors[scheme].tint;
const badgeTextColor = textColor || Colors[scheme].background;
return (
<ThemedView
style={[
@ -37,12 +38,7 @@ const ThemedBadge: React.FC<ThemedBadgeProps> = ({
]}
{...restProps}
>
<ThemedText
style={[
styles.text,
{ color: badgeTextColor, fontSize: size * 0.5 }
]}
>
<ThemedText style={[styles.text, { color: badgeTextColor, fontSize: size * 0.5 }]}>
{value}
</ThemedText>
</ThemedView>

View File

@ -1,6 +1,6 @@
import React from 'react';
import { StyleSheet, ViewProps, Platform, DimensionValue } from 'react-native';
import { ThemedView } from '@/components/theme';
import ThemedView from '@/components/theme/default/ThemedView';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
@ -23,7 +23,7 @@ const ThemedCard: React.FC<ThemedCardProps> = ({
...restProps
}) => {
const scheme = useColorScheme() ?? 'dark';
return (
<ThemedView
style={[
@ -37,7 +37,7 @@ const ThemedCard: React.FC<ThemedCardProps> = ({
...Platform.select({
ios: {
shadowColor: Colors[scheme].text,
shadowOffset: { width: 0, height: elevation/2 },
shadowOffset: { width: 0, height: elevation / 2 },
shadowOpacity: 0.1,
shadowRadius: elevation,
},

View File

@ -5,8 +5,8 @@ import { useColorScheme } from '@/hooks/useColorScheme';
type ThemedDividerProps = ViewProps & {
orientation?: 'horizontal' | 'vertical';
thickness?: DimensionValue
length?: DimensionValue
thickness?: DimensionValue;
length?: DimensionValue;
color?: string;
};
@ -19,12 +19,12 @@ const ThemedDivider: React.FC<ThemedDividerProps> = ({
}) => {
const scheme = useColorScheme() ?? 'dark';
const color = restProps.color || Colors[scheme].border;
return (
<View
style={[
orientation === 'horizontal'
? { height: thickness, width: length }
orientation === 'horizontal'
? { height: thickness, width: length }
: { width: thickness, height: length },
{ backgroundColor: color },
style,

View File

@ -10,25 +10,11 @@ type ThemedIconProps = ViewProps & {
color?: string;
};
const ThemedIcon: React.FC<ThemedIconProps> = ({
name,
size = 24,
color,
style,
...restProps
}) => {
const ThemedIcon: React.FC<ThemedIconProps> = ({ name, size = 24, color, style, ...restProps }) => {
const scheme = useColorScheme() ?? 'dark';
const iconColor = color || Colors[scheme].text;
return (
<Ionicons
name={name}
size={size}
color={iconColor}
style={style}
{...restProps}
/>
);
return <Ionicons name={name} size={size} color={iconColor} style={style} {...restProps} />;
};
export default ThemedIcon;