SEC_Warehouse/src/components/bottom-sheet/index.tsx

32 lines
865 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { View, Text } from '@tarojs/components'
import type { ReactNode } from 'react'
import styles from './index.module.scss'
interface Props {
visible: boolean
title?: string
onClose: () => void
children: ReactNode
}
export function BottomSheet({ visible, title, onClose, children }: Props) {
if (!visible) return null
return (
<>
<View className={styles.mask} onClick={onClose} />
<View className={styles.panel}>
<View className={styles.handle} />
{title && (
<View className={styles.header}>
<Text className={styles.title}>{title}</Text>
<View className={styles.close} onClick={onClose}>
<Text className={styles.closeIcon}>×</Text>
</View>
</View>
)}
<View className={styles.body}>{children}</View>
</View>
</>
)
}