import React from "react"
import { Button, Text, TouchableOpacity, View, ViewStyle } from "react-native"
import Collapsible from "react-native-collapsible"
import { Separator } from "../../Separator"
import { ProfileSectionStyles } from "../Styles/ProfileSections.styles"
import { ProfileSectionHeader } from "./ProfileSectionHeader"

interface ProfileSectionProps {
    collapseToggleMethod: () => void
    isCollapsed: boolean
    title: string
    style?: ViewStyle
}

export const ProfileSection: React.FC<ProfileSectionProps> = ({isCollapsed, collapseToggleMethod, children, title, style}) => {
    return (
        <View>
            <ProfileSectionHeader isCollapsed={isCollapsed} collapseToggleMethod={collapseToggleMethod} title={title} />
            <Collapsible collapsed={isCollapsed} >
                <View style={[style, ProfileSectionStyles.sectionCollapsibleContainer]}>
                    <Separator color="lightgray" style={{marginBottom: 25}}/>
                    {children}
                </View>
            </Collapsible>
        </View>
    )
}