import {createContext, useContext} from 'react' import {View, type ViewStyle} from 'react-native' import {atoms as a, tokens, useTheme} from '#/alf' import {type Props as SVGIconProps} from '#/components/icons/common' import {Text} from '#/components/Typography' const PanelContext = createContext<{active: boolean}>({active: false}) /** * A nice container for Toggles. See the Threadgate dialog for an example. */ export function Panel({ children, active = false, adjacent, }: { children: React.ReactNode active?: boolean adjacent?: 'leading' | 'trailing' | 'both' }) { const t = useTheme() const leading = adjacent === 'leading' || adjacent === 'both' const trailing = adjacent === 'trailing' || adjacent === 'both' const rounding = { borderTopLeftRadius: leading ? tokens.borderRadius.xs : tokens.borderRadius.md, borderTopRightRadius: leading ? tokens.borderRadius.xs : tokens.borderRadius.md, borderBottomLeftRadius: trailing ? tokens.borderRadius.xs : tokens.borderRadius.md, borderBottomRightRadius: trailing ? tokens.borderRadius.xs : tokens.borderRadius.md, } satisfies ViewStyle return ( {children} ) } export function PanelText({ children, icon, }: { children: React.ReactNode icon?: React.ComponentType }) { const t = useTheme() const ctx = useContext(PanelContext) const text = ( {children} ) if (icon) { // eslint-disable-next-line bsky-internal/avoid-unwrapped-text return ( {text} ) } return text } export function PanelIcon({ icon: Icon, }: { icon: React.ComponentType }) { const t = useTheme() const ctx = useContext(PanelContext) return ( ) } /** * A group of panels. TODO: auto-leading/trailing */ export function PanelGroup({children}: {children: React.ReactNode}) { return {children} }