Skip to content

Commit eb73fd3

Browse files
author
Tim Szot
authored
Merge pull request #4793 from studio-504/add-tablet-breakpoint
New breakpoint for tablet size
2 parents 8aafdb8 + 28ff969 commit eb73fd3

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

src/components/withWindowDimensions.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const windowDimensionsPropTypes = {
1414

1515
// Is the window width narrow, like on a mobile device?
1616
isSmallScreenWidth: PropTypes.bool.isRequired,
17+
18+
// Is the window width narrow, like on a tablet device?
19+
isMediumScreenWidth: PropTypes.bool.isRequired,
1720
};
1821

1922
export default function (WrappedComponent) {
@@ -40,10 +43,14 @@ export default function (WrappedComponent) {
4043

4144
const initialDimensions = Dimensions.get('window');
4245
const isSmallScreenWidth = initialDimensions.width <= variables.mobileResponsiveWidthBreakpoint;
46+
const isMediumScreenWidth = initialDimensions.width > variables.mobileResponsiveWidthBreakpoint
47+
&& initialDimensions.width <= variables.tabletResponsiveWidthBreakpoint;
48+
4349
this.state = {
4450
windowHeight: initialDimensions.height,
4551
windowWidth: initialDimensions.width,
4652
isSmallScreenWidth,
53+
isMediumScreenWidth,
4754
};
4855
}
4956

@@ -81,6 +88,7 @@ export default function (WrappedComponent) {
8188
windowHeight={this.state.windowHeight}
8289
windowWidth={this.state.windowWidth}
8390
isSmallScreenWidth={this.state.isSmallScreenWidth}
91+
isMediumScreenWidth={this.state.isMediumScreenWidth}
8492
/>
8593
);
8694
}

src/pages/workspace/WorkspaceCardPage.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const WorkspaceCardPage = ({
7171
user,
7272
translate,
7373
isSmallScreenWidth,
74+
isMediumScreenWidth,
7475
reimbursementAccount,
7576
}) => {
7677
const isVerifying = lodashGet(reimbursementAccount, 'achData.state', '') === BankAccount.STATE.VERIFYING;
@@ -120,12 +121,17 @@ const WorkspaceCardPage = ({
120121
styles.flexRow,
121122
styles.workspaceCard,
122123
isSmallScreenWidth && styles.workspaceCardMobile,
124+
isMediumScreenWidth && styles.workspaceCardMediumScreen,
123125
]}
124126
>
125-
{isSmallScreenWidth
127+
{isSmallScreenWidth || isMediumScreenWidth
126128
? (
127129
<HeroCardMobileImage
128-
style={StyleSheet.flatten([styles.fullscreenCard, styles.fullscreenCardMobile])}
130+
style={StyleSheet.flatten([
131+
styles.fullscreenCard,
132+
isSmallScreenWidth && styles.fullscreenCardMobile,
133+
isMediumScreenWidth && styles.fullscreenCardMediumScreen,
134+
])}
129135
/>
130136
)
131137
: (
@@ -138,6 +144,7 @@ const WorkspaceCardPage = ({
138144
styles.fullscreenCard,
139145
styles.workspaceCardContent,
140146
isSmallScreenWidth && styles.p5,
147+
isMediumScreenWidth && styles.workspaceCardContentMediumScreen,
141148
]}
142149
>
143150
<View
@@ -146,6 +153,7 @@ const WorkspaceCardPage = ({
146153
styles.justifyContentEnd,
147154
styles.alignItemsStart,
148155
!isSmallScreenWidth && styles.w50,
156+
isMediumScreenWidth && styles.w100,
149157
]}
150158
>
151159
<Text

src/styles/styles.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,12 @@ const styles = {
18841884
width: '150%',
18851885
},
18861886

1887+
fullscreenCardMediumScreen: {
1888+
left: '-15%',
1889+
top: '-30%',
1890+
width: '145%',
1891+
},
1892+
18871893
smallEditIcon: {
18881894
alignItems: 'center',
18891895
backgroundColor: themeColors.icon,
@@ -1914,6 +1920,10 @@ const styles = {
19141920
height: 475,
19151921
},
19161922

1923+
workspaceCardMediumScreen: {
1924+
height: 540,
1925+
},
1926+
19171927
workspaceCardMainText: {
19181928
fontSize: variables.fontSizeXXXLarge,
19191929
fontWeight: 'bold',
@@ -1925,6 +1935,10 @@ const styles = {
19251935
padding: 50,
19261936
},
19271937

1938+
workspaceCardContentMediumScreen: {
1939+
padding: 25,
1940+
},
1941+
19281942
workspaceCardCTA: {
19291943
width: 250,
19301944
},

src/styles/variables.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
iconSizeLarge: 24,
3030
iouAmountTextSize: 40,
3131
mobileResponsiveWidthBreakpoint: 800,
32+
tabletResponsiveWidthBreakpoint: 1024,
3233
safeInsertPercentage: 0.7,
3334
sideBarWidth: 375,
3435
pdfPageMaxWidth: 992,

0 commit comments

Comments
 (0)