Skip to content

fix: aligned the spacing for the FeatureTraining, 2FA, FocusMode, DecisionModal, and ConfirmModal #61181

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/components/ConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function ConfirmModal({
shouldSetModalVisibility={shouldSetModalVisibility}
onModalHide={onModalHide}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={image ? styles.pt0 : {}}
innerContainerStyle={styles.pv0}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
restoreFocusType={restoreFocusType}
shouldHandleNavigationBack={shouldHandleNavigationBack}
Expand Down
1 change: 1 addition & 0 deletions src/components/DecisionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function DecisionModal({title, prompt = '', firstOptionText, secondOptionText, o
isVisible={isVisible}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
shouldUseNewModal
innerContainerStyle={styles.pv0}
>
<View style={[styles.m5]}>
<View>
Expand Down
131 changes: 63 additions & 68 deletions src/components/FeatureTrainingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import Lottie from './Lottie';
import LottieAnimations from './LottieAnimations';
import type DotLottieAnimation from './LottieAnimations/types';
import Modal from './Modal';
import SafeAreaConsumer from './SafeAreaConsumer';
import Text from './Text';
import VideoPlayer from './VideoPlayer';

Expand Down Expand Up @@ -311,74 +310,70 @@ function FeatureTrainingModal({
useLayoutEffect(parseFSAttributes, []);

return (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<Modal
isVisible={isModalVisible}
type={onboardingIsMediumOrLargerScreenWidth ? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE : CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
onClose={closeModal}
innerContainerStyle={{
boxShadow: 'none',
paddingBottom: 20,
paddingTop: onboardingIsMediumOrLargerScreenWidth ? undefined : MODAL_PADDING,
...(onboardingIsMediumOrLargerScreenWidth
? // Override styles defined by MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
// To make it take as little space as possible.
{
flex: undefined,
width: 'auto',
}
: {}),
...modalInnerContainerStyle,
}}
shouldUseNewModal
>
<View
style={[styles.mh100, onboardingIsMediumOrLargerScreenWidth && StyleUtils.getWidthStyle(width), safeAreaPaddingBottomStyle]}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
<View style={[onboardingIsMediumOrLargerScreenWidth ? {padding: MODAL_PADDING} : {paddingHorizontal: MODAL_PADDING}, illustrationOuterContainerStyle]}>
{renderIllustration()}
</View>
<View style={[styles.mt5, styles.mh5, contentOuterContainerStyles]}>
{!!title && !!description && (
<View style={[onboardingIsMediumOrLargerScreenWidth ? [styles.gap1, styles.mb8] : [styles.mb10], contentInnerContainerStyles]}>
{typeof title === 'string' ? <Text style={[styles.textHeadlineH1]}>{title}</Text> : title}
<Text style={styles.textSupporting}>{description}</Text>
{secondaryDescription.length > 0 && <Text style={[styles.textSupporting, styles.mt4]}>{secondaryDescription}</Text>}
{children}
</View>
)}
{shouldShowDismissModalOption && (
<CheckboxWithLabel
label={translate('featureTraining.doNotShowAgain')}
accessibilityLabel={translate('featureTraining.doNotShowAgain')}
style={[styles.mb5]}
isChecked={!willShowAgain}
onInputChange={toggleWillShowAgain}
/>
)}
{!!helpText && (
<Button
large
style={[styles.mb3]}
onPress={onHelp}
text={helpText}
/>
)}
<Button
large
success
pressOnEnter
onPress={closeAndConfirmModal}
text={confirmText}
/>
<Modal
isVisible={isModalVisible}
type={onboardingIsMediumOrLargerScreenWidth ? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE : CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
onClose={closeModal}
innerContainerStyle={{
boxShadow: 'none',
paddingBottom: 20,
paddingTop: onboardingIsMediumOrLargerScreenWidth ? undefined : MODAL_PADDING,
...(onboardingIsMediumOrLargerScreenWidth
? // Override styles defined by MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
// To make it take as little space as possible.
{
flex: undefined,
width: 'auto',
}
: {}),
...modalInnerContainerStyle,
}}
shouldUseNewModal
>
<View
style={[styles.mh100, onboardingIsMediumOrLargerScreenWidth && StyleUtils.getWidthStyle(width)]}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
<View style={[onboardingIsMediumOrLargerScreenWidth ? {padding: MODAL_PADDING} : {paddingHorizontal: MODAL_PADDING}, illustrationOuterContainerStyle]}>
{renderIllustration()}
</View>
<View style={[styles.mt5, styles.mh5, contentOuterContainerStyles]}>
{!!title && !!description && (
<View style={[onboardingIsMediumOrLargerScreenWidth ? [styles.gap1, styles.mb8] : [styles.mb10], contentInnerContainerStyles]}>
{typeof title === 'string' ? <Text style={[styles.textHeadlineH1]}>{title}</Text> : title}
<Text style={styles.textSupporting}>{description}</Text>
{secondaryDescription.length > 0 && <Text style={[styles.textSupporting, styles.mt4]}>{secondaryDescription}</Text>}
{children}
</View>
</View>
</Modal>
)}
</SafeAreaConsumer>
)}
{shouldShowDismissModalOption && (
<CheckboxWithLabel
label={translate('featureTraining.doNotShowAgain')}
accessibilityLabel={translate('featureTraining.doNotShowAgain')}
style={[styles.mb5]}
isChecked={!willShowAgain}
onInputChange={toggleWillShowAgain}
/>
)}
{!!helpText && (
<Button
large
style={[styles.mb3]}
onPress={onHelp}
text={helpText}
/>
)}
<Button
large
success
pressOnEnter
onPress={closeAndConfirmModal}
text={confirmText}
/>
</View>
</View>
</Modal>
);
}

Expand Down
69 changes: 32 additions & 37 deletions src/components/RequireTwoFactorAuthenticationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Button from './Button';
import Lottie from './Lottie';
import LottieAnimations from './LottieAnimations';
import Modal from './Modal';
import SafeAreaConsumer from './SafeAreaConsumer';
import Text from './Text';

type RequireTwoFactorAuthenticationModalProps = {
Expand Down Expand Up @@ -39,43 +38,39 @@ function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description,
const StyleUtils = useStyleUtils();

return (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<Modal
onClose={onCancel}
isVisible={isVisible}
type={shouldUseNarrowLayout ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={{...styles.pb5, ...styles.pt0, ...styles.boxShadowNone}}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
shouldUseNewModal
>
<View style={safeAreaPaddingBottomStyle}>
<View style={[styles.cardSectionIllustration, styles.alignItemsCenter, StyleUtils.getBackgroundColorStyle(LottieAnimations.Safe.backgroundColor)]}>
<Lottie
source={LottieAnimations.Safe}
style={styles.h100}
webStyle={styles.h100}
autoPlay
loop
/>
</View>
<View style={[styles.mt5, styles.mh5]}>
<View style={[styles.gap2, styles.mb10]}>
<Text style={[styles.textHeadlineH1]}>{translate('twoFactorAuth.pleaseEnableTwoFactorAuth')}</Text>
<Text style={styles.textSupporting}>{description}</Text>
</View>
<Button
large
success
pressOnEnter
onPress={onSubmit}
text={translate('twoFactorAuth.enableTwoFactorAuth')}
/>
</View>
<Modal
onClose={onCancel}
isVisible={isVisible}
type={shouldUseNarrowLayout ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={{...styles.pb5, ...styles.pt0, ...styles.boxShadowNone}}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
shouldUseNewModal
>
<View>
<View style={[styles.cardSectionIllustration, styles.alignItemsCenter, StyleUtils.getBackgroundColorStyle(LottieAnimations.Safe.backgroundColor)]}>
<Lottie
source={LottieAnimations.Safe}
style={styles.h100}
webStyle={styles.h100}
autoPlay
loop
/>
</View>
<View style={[styles.mt5, styles.mh5]}>
<View style={[styles.gap2, styles.mb10]}>
<Text style={[styles.textHeadlineH1]}>{translate('twoFactorAuth.pleaseEnableTwoFactorAuth')}</Text>
<Text style={styles.textSupporting}>{description}</Text>
</View>
</Modal>
)}
</SafeAreaConsumer>
<Button
large
success
pressOnEnter
onPress={onSubmit}
text={translate('twoFactorAuth.enableTwoFactorAuth')}
/>
</View>
</View>
</Modal>
);
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
onClose={() => setIsPDFModalVisible(false)}
isVisible={isPDFModalVisible}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={styles.pv0}
>
<View style={[styles.m5]}>
<View>
Expand Down