-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): add missing bottom sheet to FW update
- Loading branch information
Showing
8 changed files
with
204 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { Color, TypographyStyle } from '@trezor/theme'; | ||
|
||
import { Box } from './Box'; | ||
import { Text } from './Text'; | ||
import { HStack } from './Stack'; | ||
|
||
type NumberedListItemProps = { | ||
children: ReactNode; | ||
variant?: TypographyStyle; | ||
color?: Color; | ||
number: number; | ||
}; | ||
|
||
export const NumberedListItem = ({ children, variant, color, number }: NumberedListItemProps) => ( | ||
<HStack> | ||
<Box style={{ minWidth: 16 }}> | ||
<Text variant={variant} color={color}> | ||
{number}. | ||
</Text> | ||
</Box> | ||
<Box flexShrink={1}> | ||
<Text variant={variant} color={color}> | ||
{children} | ||
</Text> | ||
</Box> | ||
</HStack> | ||
); |
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
84 changes: 84 additions & 0 deletions
84
suite-native/firmware/src/components/MayBeStuckedBottomSheet.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,84 @@ | ||
import { useState } from 'react'; | ||
import Animated, { FadeIn } from 'react-native-reanimated'; | ||
|
||
import { BottomSheet, Box, Button, NumberedListItem, Text, VStack } from '@suite-native/atoms'; | ||
import { Translation } from '@suite-native/intl'; | ||
|
||
type MayBeStuckedBottomSheetProps = { | ||
isOpened: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
export const MayBeStuckedBottomSheet = ({ isOpened, onClose }: MayBeStuckedBottomSheetProps) => { | ||
const [visiblePart, setVisiblePart] = useState<number>(1); | ||
|
||
const handleClose = () => { | ||
onClose(); | ||
setVisiblePart(1); | ||
}; | ||
|
||
return ( | ||
<BottomSheet | ||
isVisible={isOpened} | ||
onClose={onClose} | ||
isCloseDisplayed={false} | ||
paddingHorizontal="sp24" | ||
> | ||
{visiblePart === 1 && ( | ||
<Animated.View> | ||
<VStack spacing="sp24"> | ||
<VStack alignItems="center" spacing="sp8"> | ||
<Text textAlign="center" variant="titleSmall"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part1.title" /> | ||
</Text> | ||
<Text textAlign="center" color="textSubdued"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part1.description" /> | ||
</Text> | ||
</VStack> | ||
|
||
<VStack spacing="sp16"> | ||
<Button onPress={() => setVisiblePart(2)} colorScheme="yellowBold"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part1.continueButton" /> | ||
</Button> | ||
<Button onPress={handleClose} colorScheme="yellowElevation0"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part1.closeButton" /> | ||
</Button> | ||
</VStack> | ||
</VStack> | ||
</Animated.View> | ||
)} | ||
{visiblePart === 2 && ( | ||
<Animated.View entering={FadeIn}> | ||
<VStack spacing="sp24"> | ||
<VStack spacing="sp8"> | ||
<Text variant="titleSmall"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.title" /> | ||
</Text> | ||
<Text color="textSubdued"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.subtitle" /> | ||
</Text> | ||
</VStack> | ||
|
||
<VStack spacing="sp2"> | ||
<NumberedListItem number={1}> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.tip1" /> | ||
</NumberedListItem> | ||
<NumberedListItem number={2}> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.tip2" /> | ||
</NumberedListItem> | ||
<NumberedListItem number={3}> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.tip3" /> | ||
</NumberedListItem> | ||
</VStack> | ||
|
||
<Box flex={1}> | ||
<Button onPress={handleClose} colorScheme="primary"> | ||
<Translation id="moduleDeviceSettings.firmware.stuckedBottomSheet.part2.gotItButton" /> | ||
</Button> | ||
</Box> | ||
</VStack> | ||
</Animated.View> | ||
)} | ||
</BottomSheet> | ||
); | ||
}; |
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
Oops, something went wrong.