-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into notifications
- Loading branch information
Showing
36 changed files
with
2,971 additions
and
367 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
import {useTheme} from '@yoroi/theme' | ||
import React, {ReactNode} from 'react' | ||
import {StyleSheet, Text, View} from 'react-native' | ||
|
||
import {Icon} from '../Icon' | ||
import {Space} from '../Space/Space' | ||
|
||
type Props = { | ||
content: ReactNode | ||
iconSize?: number | ||
} | ||
|
||
export const Info = ({content, iconSize = 30}: Props) => { | ||
const {styles, colors} = useStyles() | ||
|
||
return ( | ||
<View style={styles.notice}> | ||
<Icon.Info size={iconSize} color={colors.blue} /> | ||
|
||
<Space height="sm" /> | ||
|
||
<Text style={styles.text}>{content}</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const useStyles = () => { | ||
const {color, atoms} = useTheme() | ||
const styles = StyleSheet.create({ | ||
notice: { | ||
backgroundColor: color.sys_cyan_100, | ||
...atoms.p_md, | ||
...atoms.rounded_sm, | ||
}, | ||
text: { | ||
...atoms.body_2_md_regular, | ||
color: color.text_gray_max, | ||
}, | ||
}) | ||
|
||
const colors = { | ||
yellow: color.sys_orange_500, | ||
blue: color.primary_500, | ||
} | ||
|
||
return {colors, styles} as const | ||
} |
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
36 changes: 36 additions & 0 deletions
36
apps/wallet-mobile/src/features/ReviewTx/ReviewTxNavigator.tsx
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,36 @@ | ||
import {createStackNavigator} from '@react-navigation/stack' | ||
import {Atoms, ThemedPalette, useTheme} from '@yoroi/theme' | ||
import React from 'react' | ||
|
||
import {Boundary} from '../../components/Boundary/Boundary' | ||
import {defaultStackNavigationOptions, ReviewTxRoutes} from '../../kernel/navigation' | ||
import {useStrings} from './common/hooks/useStrings' | ||
import {ReviewTxScreen} from './useCases/ReviewTxScreen/ReviewTxScreen' | ||
|
||
export const Stack = createStackNavigator<ReviewTxRoutes>() | ||
|
||
export const ReviewTxNavigator = () => { | ||
const {atoms, color} = useTheme() | ||
const strings = useStrings() | ||
|
||
return ( | ||
<Stack.Navigator | ||
screenOptions={{ | ||
...screenOptions(atoms, color), | ||
}} | ||
> | ||
<Stack.Screen name="review-tx" options={{title: strings.title}}> | ||
{() => ( | ||
<Boundary> | ||
<ReviewTxScreen /> | ||
</Boundary> | ||
)} | ||
</Stack.Screen> | ||
</Stack.Navigator> | ||
) | ||
} | ||
|
||
const screenOptions = (atoms: Atoms, color: ThemedPalette) => ({ | ||
...defaultStackNavigationOptions(atoms, color), | ||
gestureEnabled: true, | ||
}) |
73 changes: 73 additions & 0 deletions
73
apps/wallet-mobile/src/features/ReviewTx/common/Address.tsx
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,73 @@ | ||
import {useTheme} from '@yoroi/theme' | ||
import * as React from 'react' | ||
import {StyleSheet, Text, TextStyle, TouchableOpacity, View} from 'react-native' | ||
|
||
import {Icon} from '../../../components/Icon' | ||
import {Space} from '../../../components/Space/Space' | ||
import {useCopy} from '../../../hooks/useCopy' | ||
|
||
export const Address = ({ | ||
address, | ||
index, | ||
textStyle, | ||
multiline = false, | ||
}: { | ||
address: string | ||
index?: number | ||
textStyle?: TextStyle | ||
multiline?: boolean | ||
}) => { | ||
const {styles, colors} = useStyles() | ||
const [, copy] = useCopy() | ||
|
||
return ( | ||
<View style={styles.address}> | ||
<Text | ||
style={[styles.addressText, textStyle]} | ||
numberOfLines={!multiline ? 1 : undefined} | ||
ellipsizeMode={!multiline ? 'middle' : undefined} | ||
> | ||
{address} | ||
</Text> | ||
|
||
{index !== undefined && ( | ||
<> | ||
<Space width="sm" /> | ||
|
||
<Text style={styles.index}>{`#${index}`}</Text> | ||
|
||
<Space width="sm" /> | ||
</> | ||
)} | ||
|
||
<TouchableOpacity onPress={() => copy(address)} activeOpacity={0.5}> | ||
<Icon.Copy size={24} color={colors.copy} /> | ||
</TouchableOpacity> | ||
</View> | ||
) | ||
} | ||
|
||
const useStyles = () => { | ||
const {atoms, color} = useTheme() | ||
const styles = StyleSheet.create({ | ||
address: { | ||
...atoms.flex_row, | ||
...atoms.justify_between, | ||
}, | ||
addressText: { | ||
...atoms.flex_1, | ||
...atoms.body_2_md_regular, | ||
color: color.text_gray_medium, | ||
}, | ||
index: { | ||
...atoms.body_2_md_medium, | ||
color: color.text_gray_medium, | ||
}, | ||
}) | ||
|
||
const colors = { | ||
copy: color.gray_900, | ||
} | ||
|
||
return {styles, colors} as const | ||
} |
71 changes: 71 additions & 0 deletions
71
apps/wallet-mobile/src/features/ReviewTx/common/CollapsibleSection.tsx
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,71 @@ | ||
import {useTheme} from '@yoroi/theme' | ||
import * as React from 'react' | ||
import {Animated, LayoutAnimation, StyleSheet, Text, TouchableOpacity, View} from 'react-native' | ||
|
||
import {Icon} from '../../../components/Icon' | ||
|
||
export const CollapsibleSection = ({label, children}: {label: string; children: React.ReactNode}) => { | ||
const {styles, colors} = useStyles() | ||
const [isOpen, setIsOpen] = React.useState(false) | ||
const animatedHeight = React.useRef(new Animated.Value(0)).current | ||
|
||
const toggleSection = () => { | ||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut) | ||
setIsOpen(!isOpen) | ||
Animated.timing(animatedHeight, { | ||
toValue: isOpen ? 0 : 1, | ||
duration: 300, | ||
useNativeDriver: false, | ||
}).start() | ||
} | ||
|
||
return ( | ||
<> | ||
<View style={styles.sectionHeader}> | ||
<Text style={styles.sectionHeaderText}>{label}</Text> | ||
|
||
<TouchableOpacity activeOpacity={0.5} onPress={toggleSection}> | ||
<Icon.Chevron direction={isOpen ? 'up' : 'down'} size={28} color={colors.chevron} /> | ||
</TouchableOpacity> | ||
</View> | ||
|
||
<Animated.View | ||
style={[ | ||
styles.childrenContainer, | ||
{ | ||
maxHeight: animatedHeight.interpolate({ | ||
inputRange: [0, 1], | ||
outputRange: [0, 1000], | ||
}), | ||
opacity: animatedHeight, | ||
}, | ||
]} | ||
> | ||
{children} | ||
</Animated.View> | ||
</> | ||
) | ||
} | ||
|
||
const useStyles = () => { | ||
const {atoms, color} = useTheme() | ||
const styles = StyleSheet.create({ | ||
sectionHeader: { | ||
...atoms.flex_row, | ||
...atoms.justify_between, | ||
}, | ||
sectionHeaderText: { | ||
...atoms.body_1_lg_medium, | ||
color: color.text_gray_medium, | ||
}, | ||
childrenContainer: { | ||
overflow: 'hidden', | ||
}, | ||
}) | ||
|
||
const colors = { | ||
chevron: color.gray_900, | ||
} | ||
|
||
return {styles, colors} as const | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/wallet-mobile/src/features/ReviewTx/common/Divider.tsx
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,31 @@ | ||
import {SpacingSize, useTheme} from '@yoroi/theme' | ||
import * as React from 'react' | ||
import {StyleSheet, View} from 'react-native' | ||
|
||
import {Space} from '../../../components/Space/Space' | ||
|
||
export const Divider = ({verticalSpace = 'none'}: {verticalSpace?: SpacingSize}) => { | ||
const {styles} = useStyles() | ||
return ( | ||
<> | ||
<Space height={verticalSpace} /> | ||
|
||
<View style={styles.divider} /> | ||
|
||
<Space height={verticalSpace} /> | ||
</> | ||
) | ||
} | ||
|
||
const useStyles = () => { | ||
const {atoms, color} = useTheme() | ||
const styles = StyleSheet.create({ | ||
divider: { | ||
height: 1, | ||
...atoms.align_stretch, | ||
backgroundColor: color.gray_200, | ||
}, | ||
}) | ||
|
||
return {styles} as const | ||
} |
Oops, something went wrong.