import React from 'react'; import { GestureResponderEvent, StyleSheet, View, StyleProp, ViewStyle } from 'react-native'; import type { Theme } from '../../types'; import { withTheme } from '../../core/theming'; import { Panel, Button, Text, CloseIcon } from '../..'; type Props = React.ComponentPropsWithRef & { // TODO: allow for inserting custom buttons to title bar? active?: boolean; children?: React.ReactNode; onClose?: (evt: GestureResponderEvent) => void; onMaximize?: (evt: GestureResponderEvent) => void; onMinimize?: (evt: GestureResponderEvent) => void; style?: StyleProp; theme: Theme; title?: string; }; const Window = ({ active = true, children, onClose, onMaximize, onMinimize, style = {}, theme, title = '', ...rest }: Props) => { return ( {title} {onMinimize && ( )} {onMaximize && ( )} {onClose && ( )} {children} ); }; const styles = StyleSheet.create({ flex: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', }, window: { position: 'relative', paddingVertical: 6, paddingHorizontal: 6, }, titleBar: { height: 36, margin: 2, paddingRight: 4, paddingLeft: 8, }, titleBarText: { flexShrink: 1, }, buttonGroup: { marginRight: 6, }, button: { height: 28, width: 32, padding: 0, }, }); export default withTheme(Window);