-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOCOM-1354
# Conflicts: # ts/features/pushNotifications/sagas/__tests__/checkNotificationsPreferencesSaga.test.tsx # ts/features/pushNotifications/sagas/checkNotificationsPreferencesSaga.ts # ts/features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent.tsx # ts/screens/profile/NotificationsPreferencesScreen.tsx
- Loading branch information
Showing
41 changed files
with
3,370 additions
and
644 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
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
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,126 @@ | ||
import { | ||
Body, | ||
ButtonLink, | ||
ButtonLinkProps, | ||
ButtonSolid, | ||
ButtonSolidProps, | ||
ContentWrapper, | ||
H3, | ||
IOPictograms, | ||
IOStyles, | ||
Pictogram, | ||
VSpacer | ||
} from "@pagopa/io-app-design-system"; | ||
import { SafeAreaView } from "react-native-safe-area-context"; | ||
import * as React from "react"; | ||
import { StyleSheet, View } from "react-native"; | ||
import { | ||
BodyProps, | ||
ComposedBodyFromArray | ||
} from "../core/typography/ComposedBodyFromArray"; | ||
export type CustomWizardScreenProps = { | ||
title: string; | ||
description?: string | Array<BodyProps>; | ||
pictogram: IOPictograms; | ||
primaryButton: Pick< | ||
ButtonSolidProps, | ||
"label" | "accessibilityLabel" | "onPress" | "testID" | ||
>; | ||
actionButton?: Pick< | ||
ButtonLinkProps, | ||
"label" | "accessibilityLabel" | "onPress" | "testID" | ||
>; | ||
buttonLink?: Pick< | ||
ButtonLinkProps, | ||
"label" | "accessibilityLabel" | "onPress" | "testID" | ||
>; | ||
}; | ||
|
||
/** | ||
* A common screen used in a wizard flow to show a pictogram, a title, a description and one or two buttons. | ||
*/ | ||
const CustomWizardScreen = ({ | ||
title, | ||
description, | ||
pictogram, | ||
primaryButton, | ||
actionButton, | ||
buttonLink | ||
}: CustomWizardScreenProps) => ( | ||
<SafeAreaView style={IOStyles.flex}> | ||
<WizardBody | ||
pictogram={pictogram} | ||
title={title} | ||
description={description} | ||
buttonLink={buttonLink} | ||
/> | ||
<ContentWrapper> | ||
<ButtonSolid {...primaryButton} fullWidth={true} /> | ||
{actionButton && ( | ||
<> | ||
<VSpacer size={24} /> | ||
<View style={[IOStyles.alignCenter, IOStyles.selfCenter]}> | ||
<ButtonLink {...actionButton} /> | ||
</View> | ||
<VSpacer size={16} /> | ||
</> | ||
)} | ||
</ContentWrapper> | ||
</SafeAreaView> | ||
); | ||
|
||
type CustomWizardBodyProps = { | ||
title: string; | ||
description?: string | Array<BodyProps>; | ||
pictogram: IOPictograms; | ||
buttonLink?: Pick< | ||
ButtonLinkProps, | ||
"label" | "accessibilityLabel" | "onPress" | "testID" | ||
>; | ||
}; | ||
|
||
const WizardBody = ({ | ||
title, | ||
description, | ||
pictogram, | ||
buttonLink | ||
}: CustomWizardBodyProps) => ( | ||
<View style={styles.wizardContent}> | ||
<View style={IOStyles.alignCenter}> | ||
<Pictogram name={pictogram} size={120} /> | ||
</View> | ||
<VSpacer size={24} /> | ||
<View style={{ paddingHorizontal: 28 }}> | ||
<H3 style={styles.textCenter}>{title}</H3> | ||
{description && ( | ||
<> | ||
<VSpacer size={8} /> | ||
{typeof description === "string" ? ( | ||
<Body style={styles.textCenter}>{description}</Body> | ||
) : ( | ||
<ComposedBodyFromArray body={description} textAlign="center" /> | ||
)} | ||
</> | ||
)} | ||
{buttonLink && ( | ||
<View style={IOStyles.selfCenter}> | ||
<VSpacer size={16} /> | ||
<ButtonLink {...buttonLink} /> | ||
</View> | ||
)} | ||
</View> | ||
</View> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
textCenter: { | ||
textAlign: "center" | ||
}, | ||
wizardContent: { | ||
...IOStyles.flex, | ||
...IOStyles.horizontalContentPadding, | ||
...IOStyles.centerJustified | ||
} | ||
}); | ||
|
||
export { CustomWizardScreen }; |
35 changes: 35 additions & 0 deletions
35
ts/features/services/common/components/CardPressableBase.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,35 @@ | ||
import React from "react"; | ||
import { Pressable } from "react-native"; | ||
import Animated from "react-native-reanimated"; | ||
import { PressableBaseProps, WithTestID } from "@pagopa/io-app-design-system"; | ||
import { useSpringPressScaleAnimation } from "../../../../components/ui/utils/hooks/useSpringPressScaleAnimation"; | ||
|
||
type CardPressableBaseProps = WithTestID<PressableBaseProps>; | ||
|
||
export const CardPressableBase = ({ | ||
onPress, | ||
testID, | ||
accessibilityLabel, | ||
children | ||
}: React.PropsWithChildren<CardPressableBaseProps>) => { | ||
const { onPressIn, onPressOut, animatedScaleStyle } = | ||
useSpringPressScaleAnimation(); | ||
|
||
if (onPress === undefined) { | ||
return <>{children}</>; | ||
} | ||
|
||
return ( | ||
<Pressable | ||
onPress={onPress} | ||
testID={testID} | ||
accessible={true} | ||
accessibilityLabel={accessibilityLabel} | ||
onPressIn={onPressIn} | ||
onPressOut={onPressOut} | ||
onTouchEnd={onPressOut} | ||
> | ||
<Animated.View style={animatedScaleStyle}>{children}</Animated.View> | ||
</Pressable> | ||
); | ||
}; |
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.