import { useMemo, type ReactNode } from 'react' import { View, type StyleProp, type ViewProps, type ViewStyle } from 'react-native' import type { ColorPairToken } from '@helpwave/hightide-design/theme-tokens' import { HightideIconRegistry } from '../../icons/HightideIconRegistry' import { ThemedIcon } from '../visualization-and-display/ThemedIcon' import { ThemedText } from '../visualization-and-display/ThemedText' import { useTheme } from '../../global-contexts/theme/ThemeContext' import type { ChatSystemLineState, ChatSystemLineStyle, ChatSystemLineTextStyle } from '../../theme/types/components/chat' import type { StyleOverwrite } from '../../theme/types/resolver' export type ChatSystemLineProps = Omit & { icon?: ReactNode, color?: ColorPairToken, children?: ReactNode, style?: StyleProp, lineStyle?: StyleOverwrite, textStyle?: StyleOverwrite, } export const ChatSystemLine = ({ icon, color, children, style, lineStyle, textStyle, ...props }: ChatSystemLineProps) => { const { theme } = useTheme() const state = useMemo(() => ({ color }), [color]) const resolvedLineStyle = useMemo( () => theme.components.chat.systemLine.container(state, lineStyle), [theme, state, lineStyle] ) const resolvedTextStyle = useMemo( () => theme.components.chat.systemLine.text(state, textStyle), [theme, state, textStyle] ) const resolvedIcon = useMemo( () => theme.components.chat.systemLine.icon(state), [theme, state] ) return ( {icon ?? ( )} {typeof children === 'string' || typeof children === 'number' ? ( {children} ) : ( children )} ) }