-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(IT Wallet): [SIW-579] Refactor componente
ItwResultScreen
(#5114
) ## Short description This PR proposes a refactor of the `ItwResultScreen` to align it more closely with its intended function as a screen body, rather than a standalone screen. This component can serve as an error mapping component in a folded `pot` or as the foundational element for handling various types of errors. Therefore, it should no longer include any screen-related base components but should instead function solely as a body component. ## List of changes proposed in this pull request - Renames the component to `ItwKoView.tsx`; - Removes the outer `SafeAreaView` component which should be handled instead by the parent screen component; - Adjusts its usage in the `ItwMissingFeatureScreen.tsx`. ## How to test Check the `ItwMissingFeatureScreen` for any regression both with old and new design system.
- Loading branch information
1 parent
8b343a8
commit 3a60dd7
Showing
3 changed files
with
108 additions
and
110 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,96 @@ | ||
import { | ||
ButtonLink, | ||
ButtonSolid, | ||
H3, | ||
IOPictograms, | ||
LabelSmall, | ||
Pictogram, | ||
VSpacer, | ||
WithTestID | ||
} from "@pagopa/io-app-design-system"; | ||
import * as React from "react"; | ||
import { Platform, StyleSheet, View } from "react-native"; | ||
import { ScrollView } from "react-native-gesture-handler"; | ||
|
||
type ActionProps = { | ||
label: string; | ||
accessibilityLabel: string; | ||
onPress: () => void; | ||
}; | ||
|
||
type ItwKoViewProps = WithTestID<{ | ||
pictogram?: IOPictograms; | ||
title: string; | ||
subtitle?: string; | ||
action?: ActionProps; | ||
secondaryAction?: ActionProps; | ||
}>; | ||
|
||
const ItwKoView = ({ | ||
pictogram, | ||
title, | ||
subtitle, | ||
action, | ||
secondaryAction, | ||
testID | ||
}: ItwKoViewProps) => ( | ||
<ScrollView | ||
testID={testID} | ||
centerContent={true} | ||
contentContainerStyle={[ | ||
styles.wrapper, | ||
/* Android fallback because `centerContent` is only an iOS property */ | ||
Platform.OS === "android" && styles.wrapper_android | ||
]} | ||
> | ||
{pictogram && ( | ||
<> | ||
<Pictogram name={pictogram} size={120} /> | ||
<VSpacer size={24} /> | ||
</> | ||
)} | ||
<H3 style={styles.text}>{title}</H3> | ||
{subtitle && ( | ||
<> | ||
<VSpacer size={8} /> | ||
<LabelSmall style={styles.text} color="grey-650" weight="Regular"> | ||
{subtitle} | ||
</LabelSmall> | ||
</> | ||
)} | ||
{action && ( | ||
<> | ||
<VSpacer size={24} /> | ||
<View> | ||
<ButtonSolid {...action} /> | ||
</View> | ||
</> | ||
)} | ||
{secondaryAction && ( | ||
<> | ||
<VSpacer size={24} /> | ||
<View> | ||
<ButtonLink {...secondaryAction} /> | ||
</View> | ||
</> | ||
)} | ||
</ScrollView> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
flex: 1, | ||
alignItems: "center", | ||
justifyContent: "center", | ||
alignContent: "center" | ||
}, | ||
wrapper_android: { | ||
flexGrow: 1, | ||
justifyContent: "center" | ||
}, | ||
text: { | ||
textAlign: "center" | ||
} | ||
}); | ||
|
||
export default ItwKoView; |
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
102 changes: 0 additions & 102 deletions
102
ts/features/it-wallet/screens/generic/ItwResultScreen.tsx
This file was deleted.
Oops, something went wrong.