Skip to content

Commit

Permalink
fix:child component and spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacper-RF committed Oct 19, 2023
1 parent bb1d8b7 commit 14154d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Typography } from '../Typography/Typography.component'
import { ContextMenuItemProps, ContextMenuProps } from './ContextMenu.types'
import { defaultPalette } from '../../styles/palettes/default.palette'
import { appImages } from '../../assets'
import { Button } from '../Button/Button.component'

export const ContextMenu: FC<ContextMenuProps> = ({
visible,
Expand All @@ -16,8 +15,8 @@ export const ContextMenu: FC<ContextMenuProps> = ({
linkAction = () => {
console.log('No action attached for link tap gesture.')
},
unregisteredUsername,
username,

children,
}) => {
const [show, setShow] = React.useState<boolean>(false)
const slidingAnimation = React.useRef(new Animated.Value(0)).current
Expand Down Expand Up @@ -163,24 +162,7 @@ export const ContextMenu: FC<ContextMenuProps> = ({
/>
</View>
)}

{unregisteredUsername && username && (
<View style={{ padding: 20, alignItems: 'center' }}>
<Typography fontSize={14} style={{ textAlign: 'center' }}>
The username{' '}
<Typography fontSize={14} fontWeight={'bold'}>
@{username}
</Typography>{' '}
has not been registered yet with the community owner, so it’s still possible for someone else to
register the same username. When the community owner is online,{' '}
<Typography fontSize={14} fontWeight={'bold'}>
@{username}
</Typography>{' '}
will be registered automatically and this alert will go away.
</Typography>
<Button width={60} title={'OK'} onPress={handleClose} />
</View>
)}
{children}
</View>
</TouchableWithoutFeedback>
</Animated.View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,31 @@ import { useContextMenu } from '../../../hooks/useContextMenu'
import { MenuName } from '../../../const/MenuNames.enum'
import { ContextMenu } from '../ContextMenu.component'
import { UnregisteredUsernameArgs } from '../ContextMenu.types'
import { View } from 'react-native'
import { Typography } from '../../Typography/Typography.component'
import { Button } from '../../Button/Button.component'

export const UnregisteredUsernameContextMenu: FC = () => {
const title = 'Unregistered username'
const usernameTakenContextMenu = useContextMenu<UnregisteredUsernameArgs>(MenuName.UnregisteredUsername)

return (
<ContextMenu
title={title}
items={[]}
{...usernameTakenContextMenu}
unregisteredUsername
username={usernameTakenContextMenu.username}
/>
<ContextMenu title={title} items={[]} {...usernameTakenContextMenu}>
<View style={{ padding: 20, alignItems: 'center' }}>
<Typography fontSize={14} style={{ textAlign: 'center', lineHeight: 20 }}>
The username{' '}
<Typography fontSize={14} fontWeight={'bold'}>
@{usernameTakenContextMenu.username}
</Typography>{' '}
has not been registered yet with the community owner, so it’s still possible for someone else to register the
same username. When the community owner is online,{' '}
<Typography fontSize={14} fontWeight={'bold'}>
@{usernameTakenContextMenu.username}
</Typography>{' '}
will be registered automatically and this alert will go away.
</Typography>
<Button width={60} title={'OK'} onPress={usernameTakenContextMenu.handleClose} />
</View>
</ContextMenu>
)
}

0 comments on commit 14154d5

Please sign in to comment.