import React from 'react'; import { View, ScrollView, Pressable } from 'react-native'; import { useTheme } from '~/features/theme/ThemeProvider'; import Icon from '~/components/atoms/Icon'; import BaseModal from '~/components/atoms/BaseModal'; import Text from '~/components/atoms/Text'; import { Space } from '~/features/spaces'; interface SpaceSelectorModalProps { visible: boolean; onClose: () => void; spaces: Space[]; onSelectSpace: (spaceId: string) => void; selectedSpaceId: string | null; } /** * Eine Komponente, die einen Modal für die Auswahl eines Spaces anzeigt. * * Beispiel: * ```tsx * setIsSpaceSelectorVisible(false)} * spaces={spaces} * onSelectSpace={handleSelectSpace} * selectedSpaceId={selectedSpaceId} * /> * ``` */ const SpaceSelectorModal = ({ visible, onClose, spaces, onSelectSpace, selectedSpaceId, }: SpaceSelectorModalProps) => { const { isDark } = useTheme(); // Dynamische Klassen basierend auf dem Theme const headerTextClass = isDark ? 'text-white' : 'text-black'; const emptyTextClass = isDark ? 'text-gray-400' : 'text-gray-500'; return ( {/* Space Liste */} {spaces.length === 0 ? ( Keine Spaces gefunden. ) : ( {spaces.map((space) => ( onSelectSpace(space.id)} > {space.name} {space.description && ( {space.description} )} {selectedSpaceId === space.id && ( )} ))} )} ); }; export default SpaceSelectorModal;