-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60dca77
commit 5368b16
Showing
6 changed files
with
191 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Trans } from '@lingui/macro'; | ||
import { FC, ReactNode } from 'react'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import Container from '../ui/Container'; | ||
import Text from '../ui/Text'; | ||
import IconButton from '../ui/IconButton'; | ||
import { BackIcon } from '../icons/BackIcon'; | ||
import { useNavigation } from 'expo-router'; | ||
|
||
type SectionProps = { | ||
title: string; | ||
children: ReactNode; | ||
showBack?: boolean; | ||
}; | ||
|
||
const Section: FC<SectionProps> = ({ children, title, showBack }) => { | ||
const { goBack } = useNavigation(); | ||
return ( | ||
<Container> | ||
<View style={styles.container}> | ||
<View style={styles.head}> | ||
<View> | ||
{showBack && ( | ||
<IconButton | ||
onPress={() => { | ||
goBack(); | ||
}} | ||
style={styles.button} | ||
> | ||
<BackIcon width={24} /> | ||
</IconButton> | ||
)} | ||
</View> | ||
<Text size="headlineSmall" variant={['bold', 'primary']}> | ||
<Trans>{title}</Trans> | ||
</Text> | ||
</View> | ||
<View style={styles.wrapper}>{children}</View> | ||
</View> | ||
</Container> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
padding: 0, | ||
margin: 0, | ||
}, | ||
button: { | ||
paddingRight: 16, | ||
width: 36, | ||
minWidth: 20, | ||
}, | ||
head: { | ||
flexDirection: 'row', | ||
alignContent: 'center', | ||
}, | ||
wrapper: { | ||
flexGrow: 1, | ||
}, | ||
}); | ||
|
||
export default Section; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { FC } from 'react'; | ||
import Svg, { Path } from 'react-native-svg'; | ||
import colors from '../constants/colors'; | ||
import { ComponentWithColor, ComponentWithSize } from '../types'; | ||
|
||
export const BackIcon: FC<ComponentWithSize & ComponentWithColor> = ({ | ||
width = 48, | ||
height = 48, | ||
color = colors.dark, | ||
}) => { | ||
return ( | ||
<Svg viewBox="0 0 24 24" width={width} height={height}> | ||
<Path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" | ||
stroke={color} | ||
strokeWidth={2} | ||
/> | ||
</Svg> | ||
); | ||
}; |
Oops, something went wrong.