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

Fix Web Safari Signin page layout #4802

Merged
merged 5 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 8 additions & 0 deletions src/components/withWindowDimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const windowDimensionsPropTypes = {

// Is the window width narrow, like on a mobile device?
isSmallScreenWidth: PropTypes.bool.isRequired,

// Is the window width narrow, like on a tablet device?
isMediumScreenWidth: PropTypes.bool.isRequired,
};

export default function (WrappedComponent) {
Expand All @@ -40,10 +43,12 @@ export default function (WrappedComponent) {

const initialDimensions = Dimensions.get('window');
const isSmallScreenWidth = initialDimensions.width <= variables.mobileResponsiveWidthBreakpoint;
const isMediumScreenWidth = !isSmallScreenWidth && initialDimensions.width <= variables.mediumScreenResponsiveWidthBreakpoint;
this.state = {
windowHeight: initialDimensions.height,
windowWidth: initialDimensions.width,
isSmallScreenWidth,
isMediumScreenWidth,
};
}

Expand All @@ -64,10 +69,12 @@ export default function (WrappedComponent) {
onDimensionChange(newDimensions) {
const {window} = newDimensions;
const isSmallScreenWidth = window.width <= variables.mobileResponsiveWidthBreakpoint;
const isMediumScreenWidth = !isSmallScreenWidth && window.width <= variables.mediumScreenResponsiveWidthBreakpoint;
this.setState({
windowHeight: window.height,
windowWidth: window.width,
isSmallScreenWidth,
isMediumScreenWidth,
});
}

Expand All @@ -81,6 +88,7 @@ export default function (WrappedComponent) {
windowHeight={this.state.windowHeight}
windowWidth={this.state.windowWidth}
isSmallScreenWidth={this.state.isSmallScreenWidth}
isMediumScreenWidth={this.state.isMediumScreenWidth}
/>
);
}
Expand Down
9 changes: 7 additions & 2 deletions src/pages/signin/SignInPageLayout/SignInPageLayoutWide.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ const propTypes = {
* on form type (set password, sign in, etc.) */
welcomeText: PropTypes.string.isRequired,

/* Flag to check medium screen with device */
isMediumScreenWidth: PropTypes.string.isRequired,

...withLocalizePropTypes,
};

const SignInPageLayoutWide = props => (
<View style={[styles.signInPageInner]}>
<View style={[styles.flex1, styles.signInPageInner]}>
<View style={[styles.flex1, styles.flexRow, styles.dFlex, styles.flexGrow1]}>
<View style={[styles.signInPageWideLeftContainer, styles.dFlex, styles.flexColumn, styles.ph6]}>
<View style={[
Expand Down Expand Up @@ -61,7 +64,9 @@ const SignInPageLayoutWide = props => (
styles.justifyContentAround,
styles.backgroundBlue,
styles.pb10Percentage,
styles.p20,
!props.isMediumScreenWidth && styles.p20,
props.isMediumScreenWidth && styles.p10,
props.isMediumScreenWidth && styles.alignItemsCenter,
]}
>
<View style={[styles.dFlex, styles.flexColumnReverse, styles.alignItemsCenter, styles.w50]}>
Expand Down
9 changes: 8 additions & 1 deletion src/pages/signin/SignInPageLayout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ const propTypes = {

const SignInPageLayout = props => (
!props.isSmallScreenWidth
? <SignInPageLayoutWide welcomeText={props.welcomeText}>{props.children}</SignInPageLayoutWide>
? (
<SignInPageLayoutWide
welcomeText={props.welcomeText}
isMediumScreenWidth={props.isMediumScreenWidth}
>
{props.children}
</SignInPageLayoutWide>
)
: <SignInPageLayoutNarrow welcomeText={props.welcomeText}>{props.children}</SignInPageLayoutNarrow>
);

Expand Down
4 changes: 3 additions & 1 deletion src/styles/utilities/spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ export default {
p5: {
padding: 20,
},

p10: {
padding: 40,
},
p20: {
padding: 80,
},
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
iconSizeLarge: 24,
iouAmountTextSize: 40,
mobileResponsiveWidthBreakpoint: 800,
mediumScreenResponsiveWidthBreakpoint: 1024,
safeInsertPercentage: 0.7,
sideBarWidth: 375,
pdfPageMaxWidth: 992,
Expand Down