Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [IOBP-341] Update IDPayPaymentCodeInputScreen to use new DS components #5136

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ts/features/design-system/core/DSLogos.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import * as React from "react";
import { ScrollView, StyleSheet, View } from "react-native";
import {
useIOTheme,
Avatar,
HSpacer,
VSpacer,
IOColors,
IOLogoPaymentCardType,
IOLogoPaymentExtType,
IOLogoPaymentType,
IOPaymentCardLogos,
IOPaymentExtLogos,
IOPaymentLogos,
IOVisualCostants,
LogoPayment,
LogoPaymentExt,
LogoPaymentCard,
IOPaymentCardLogos,
IOLogoPaymentCardType,
IOColors,
LogoPaymentExt,
VSpacer,
hexToRgba,
Avatar,
IOVisualCostants
useIOTheme
} from "@pagopa/io-app-design-system";
import * as React from "react";
import { ScrollView, StyleSheet, View } from "react-native";
import { H2 } from "../../../components/core/typography/H2";
import { LogoPaymentExtended } from "../../../components/ui/LogoPaymentExtended";
import { DSComponentViewerBox } from "../components/DSComponentViewerBox";
Expand Down
2 changes: 1 addition & 1 deletion ts/features/design-system/core/DSModules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const renderModuleIDP = () => (
/>
</View>
</DSComponentViewerBox>
<DSComponentViewerBox name="ModuleIDP, saved variant">
<DSComponentViewerBox name="ModuleIDP, loose spacing (fka saved) variant">
<View>
<ModuleIDP
withLooseSpacing
Expand Down
69 changes: 36 additions & 33 deletions ts/features/idpay/payment/screens/IDPayPaymentCodeInputScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import {
FooterWithButtons,
IOStyles,
IOVisualCostants,
TextInput,
VSpacer
} from "@pagopa/io-app-design-system";
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings";
import { useSelector } from "@xstate/react";
import * as E from "fp-ts/lib/Either";
import * as O from "fp-ts/lib/Option";
import { pipe } from "fp-ts/lib/function";
import React from "react";
import { SafeAreaView, StatusBar, StyleSheet, View } from "react-native";
import { IOVisualCostants, VSpacer } from "@pagopa/io-app-design-system";
import { LabelledItem } from "../../../../components/LabelledItem";
import { Body } from "../../../../components/core/typography/Body";
import { H1 } from "../../../../components/core/typography/H1";
import { IOStyles } from "../../../../components/core/variables/IOStyles";
import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent";
import FooterWithButtons from "../../../../components/ui/FooterWithButtons";
import I18n from "../../../../i18n";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
import { IDPayTransactionCode } from "../common/types";
import { usePaymentMachineService } from "../xstate/provider";
import { isLoadingSelector } from "../xstate/selectors";
import I18n from "../../../../i18n";

type InputState = {
value?: string;
Expand Down Expand Up @@ -50,40 +53,40 @@ const IDPayPaymentCodeInputScreen = () => {
<VSpacer size={16} />
<Body>{I18n.t("idpay.payment.manualInput.subtitle")}</Body>
<VSpacer size={40} />
{/* FIXME replace with the new input field from the Design System 2.0 */}
<LabelledItem
isValid={isInputValid}
accessibilityLabel={I18n.t("idpay.payment.manualInput.input")}
inputMaskProps={{
type: "custom",
options: { mask: "SSSSSSSS" },
keyboardType: "default",
returnKeyType: "done",
value: inputState.value,
autoCapitalize: "none",
placeholder: I18n.t("idpay.payment.manualInput.input"),
onChangeText: value => {
setInputState({
<TextInput
textInputProps={{
inputMode: "",
autoCapitalize: "characters",
autoCorrect: false
}}
onChangeText={value => {
setInputState({
value,
mastro993 marked this conversation as resolved.
Show resolved Hide resolved
code: pipe(
value,
code: pipe(
value,
O.fromNullable,
O.filter(NonEmptyString.is),
O.map(IDPayTransactionCode.decode)
)
});
}
O.fromNullable,
O.filter(NonEmptyString.is),
O.map(IDPayTransactionCode.decode)
)
});
}}
placeholder={I18n.t("idpay.payment.manualInput.input")}
accessibilityLabel={I18n.t("idpay.payment.manualInput.input")}
value={inputState.value ?? ""}
counterLimit={8}
/>
</View>
<FooterWithButtons
type="SingleButton"
leftButton={{
title: I18n.t("idpay.payment.manualInput.button"),
accessibilityLabel: I18n.t("idpay.payment.manualInput.button"),
disabled: !isInputValid,
onPress: navigateToPaymentAuthorization,
isLoading
primary={{
type: "Solid",
buttonProps: {
label: I18n.t("idpay.payment.manualInput.button"),
accessibilityLabel: I18n.t("idpay.payment.manualInput.button"),
disabled: !isInputValid,
onPress: navigateToPaymentAuthorization,
loading: isLoading
}
}}
/>
</SafeAreaView>
Expand Down
Loading