/** * Copyright (c) Paymium. * * This source code is licensed under the MIT license found in the * LICENSE file in the root of this projects source tree. */ import { composeStyles, createStyles, inlineStyle } from '@crossed/styled'; import { Box, type BoxProps } from '../../layout/Box'; import { CloseButton } from '../../buttons/CloseButton'; import { useContext } from 'react'; import { localContext } from './context'; import { ModalTrigger } from './Trigger'; const styles = createStyles(() => ({ header: { media: { xs: { flexDirection: 'column-reverse', alignItems: 'flex-start' }, md: { flexDirection: 'row' }, }, }, })); export const ModalHeader = ({ children, style, ...props }: BoxProps) => { const { showSheet, closable } = useContext(localContext); const isClosable = typeof closable === 'boolean' ? closable : true; return ( ({ base: { flexGrow: 1, flexShrink: 1 } }))} > {children} {showSheet || !isClosable ? null : ( ({ base: { position: 'absolute', right: 0 }, })) : inlineStyle(() => ({ base: { alignSelf: 'flex-end' }, })) )} /> )} ); }; ModalHeader.displayName = 'Modal.Header';