Skip to content

Commit

Permalink
feat: tipping success modal (keep-starknet-strange#168)
Browse files Browse the repository at this point in the history
* feat: tipping success modal

* feat: tipping success modal

* refac: tipping success modal

* refac: remove icon

* Remove package-lock.json

* remove yarn.lock

* refac: improve ui

* refac: improve tipping modal ui
  • Loading branch information
EjembiEmmanuel authored Jun 17, 2024
1 parent 4d10802 commit 2c03f39
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
Binary file added JoyboyCommunity/src/assets/tipping-modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions JoyboyCommunity/src/components/TippingModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {useNavigation} from '@react-navigation/native';
import React from 'react';
import {Image, View} from 'react-native';
import {Portal} from 'react-native-portalize';

import {useStyles} from '../../hooks';
import {MainStackNavigationProps} from '../../types';
import {Button, Text} from '..';
import stylesheet from './styles';

export type TippingModalProps = {
user: string;
symbol: string;
amount: number;
visible?: boolean;
};

export const TippingModal: React.FC<TippingModalProps> = ({
user,
symbol,
amount,
visible = true,
}) => {
const styles = useStyles(stylesheet);

const navigation = useNavigation<MainStackNavigationProps>();

if (!visible) return null;

return (
<Portal>
<View style={styles.container}>
<View style={styles.modalContainer}>
<View style={styles.modal}>
<View style={styles.logo}>
<Image
style={styles.logoImage}
source={require('../../assets/tipping-modal.png')}
resizeMode="cover"
/>
</View>

<View style={styles.content}>
<Text color="text" weight="bold" fontSize={21} lineHeight={24}>
Tipped {user}
</Text>
<Text color="primary" weight="bold" fontSize={21} lineHeight={24}>
{amount} {symbol}
</Text>
<Text color="textSecondary" weight="medium" fontSize={15} lineHeight={24}>
Keep spreading love
</Text>

<Button
style={styles.button}
onPress={() => {
navigation.navigate('Home');
}}
variant="secondary"
>
Home
</Button>
</View>
</View>
</View>
</View>
</Portal>
);
};
47 changes: 47 additions & 0 deletions JoyboyCommunity/src/components/TippingModal/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {Spacing, ThemedStyleSheet} from '../../styles';

export default ThemedStyleSheet((theme) => ({
container: {
flex: 1,
},
modalContainer: {
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
backgroundColor: 'rgba(0, 0, 0, 0.4)',
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'center',
},
modal: {
width: '80%',
height: '40%',
backgroundColor: theme.colors.surface,
borderRadius: 24,
},
logo: {
position: 'absolute',
top: '-43%',
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'center',
},
logoImage: {
width: 238,
},
content: {
gap: Spacing.small,
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'flex-end',
paddingHorizontal: Spacing.large,
paddingVertical: Spacing.medium,
},
button: {
width: '100%',
},
}));

0 comments on commit 2c03f39

Please sign in to comment.