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 = {
children: React.ReactNode
title: string
closeModal: () => void
closeModal?: () => void
isModalWidth?: boolean
}
const PanelContent = ({ children, title, closeModal }: PanelContentProps) => {
const PanelContent = ({
children,
title,
closeModal,
isModalWidth,
}: PanelContentProps) => {
return (
<YStack space={'$3'} style={{ padding: '30px', alignItems: 'start' }}>
<XStack style={{ width: '100%', justifyContent: 'space-between' }}>
<Text size={19} weight={'semibold'}>
{title}
</Text>
<ExpandRsIcon
size={20}
style={{ cursor: 'pointer' }}
onClick={closeModal}
/>
{isModalWidth && (
<ExpandRsIcon
size={20}
style={{ cursor: 'pointer' }}
onClick={closeModal}
/>
)}
</XStack>
{children}
</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}
</PanelContent>
</Modal>
) : (
<div>
<PanelContent title={title} closeModal={closeModal}>
{children}
</PanelContent>
</div>
<PanelContent title={title}>{children}</PanelContent>
)}
</>
)