feat(panel-content): hide icon for removing modal

This commit is contained in:
RadoslavDimchev 2024-04-15 17:54:52 +03:00 committed by Radoslav Dimchev
parent 69d86c31d5
commit 7b90e3782e
2 changed files with 21 additions and 13 deletions

View File

@ -5,21 +5,29 @@ import { XStack, YStack } from 'tamagui'
type PanelContentProps = { type PanelContentProps = {
children: React.ReactNode children: React.ReactNode
title: string title: string
closeModal: () => void closeModal?: () => void
isModalWidth?: boolean
} }
const PanelContent = ({ children, title, closeModal }: PanelContentProps) => { const PanelContent = ({
children,
title,
closeModal,
isModalWidth,
}: PanelContentProps) => {
return ( return (
<YStack space={'$3'} style={{ padding: '30px', alignItems: 'start' }}> <YStack space={'$3'} style={{ padding: '30px', alignItems: 'start' }}>
<XStack style={{ width: '100%', justifyContent: 'space-between' }}> <XStack style={{ width: '100%', justifyContent: 'space-between' }}>
<Text size={19} weight={'semibold'}> <Text size={19} weight={'semibold'}>
{title} {title}
</Text> </Text>
<ExpandRsIcon {isModalWidth && (
size={20} <ExpandRsIcon
style={{ cursor: 'pointer' }} size={20}
onClick={closeModal} style={{ cursor: 'pointer' }}
/> onClick={closeModal}
/>
)}
</XStack> </XStack>
{children} {children}
</YStack> </YStack>

View File

@ -42,16 +42,16 @@ const PanelWrapper = ({ children, title }: PanelWrapperProps) => {
}, },
}} }}
> >
<PanelContent title={title} closeModal={closeModal}> <PanelContent
title={title}
closeModal={closeModal}
isModalWidth={isModalWidth}
>
{children} {children}
</PanelContent> </PanelContent>
</Modal> </Modal>
) : ( ) : (
<div> <PanelContent title={title}>{children}</PanelContent>
<PanelContent title={title} closeModal={closeModal}>
{children}
</PanelContent>
</div>
)} )}
</> </>
) )