Skip to content

Commit 2e53756

Browse files
committed
feat(protocol-designer): use CSS Modules for Landing page component
use CSS Modules for Landing page component close AUTH-
1 parent a60acd2 commit 2e53756

File tree

5 files changed

+74
-61
lines changed

5 files changed

+74
-61
lines changed

app/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@opentrons/step-generation": "link:../step-generation",
3131
"@thi.ng/paths": "1.6.5",
3232
"@types/uuid": "^3.4.7",
33-
"classnames": "2.2.5",
3433
"connected-react-router": "6.9.3",
3534
"core-js": "3.2.1",
3635
"date-fns": "2.25.0",
@@ -69,7 +68,6 @@
6968
},
7069
"devDependencies": {
7170
"@tanstack/react-query-devtools": "5.59.16",
72-
"@types/classnames": "2.2.5",
7371
"@types/file-saver": "2.0.1",
7472
"@types/jszip": "3.1.7",
7573
"@types/mixpanel-browser": "^2.35.6",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"babel-loader": "^8.2.2",
7979
"babel-plugin-styled-components": "2.0.7",
8080
"babel-plugin-unassert": "^3.0.1",
81+
"classnames": "2.5.1",
8182
"concurrently": "8.2.2",
8283
"conventional-changelog": "^3.1.25",
8384
"core-js": "^3.6.4",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.label {
2+
display: inline-block;
3+
cursor: pointer;
4+
}
5+
6+
.label input[type='file'] {
7+
display: none;
8+
}
9+
10+
.buttonText {
11+
line-height: 1.5rem; /* 24px */
12+
font-size: 1rem;
13+
font-style: normal;
14+
font-weight: 600; /* semibold */
15+
}
16+
17+
.navLink {
18+
color: white;
19+
text-decoration: none;
20+
}
21+
22+
.hiddenInput {
23+
display: none;
24+
}
25+
26+
.landingPage {
27+
display: flex;
28+
background-color: #f7f8fa; /* COLORS.grey10 */
29+
flex-direction: column;
30+
align-items: center;
31+
justify-content: center;
32+
height: calc(100vh - 9rem);
33+
width: 100%;
34+
gap: 2rem; /* SPACING.spacing32 */
35+
}
36+
37+
.contentSection {
38+
display: flex;
39+
flex-direction: column;
40+
gap: 1rem; /* SPACING.spacing16 */
41+
}
42+
43+
.textSection {
44+
display: flex;
45+
flex-direction: column;
46+
gap: 0.5rem; /* SPACING.spacing8 */
47+
align-items: center;
48+
}

protocol-designer/src/pages/Landing/index.tsx

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@ import { useEffect, useRef, useState } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { useDispatch, useSelector } from 'react-redux'
44
import { NavLink, useNavigate } from 'react-router-dom'
5-
import styled from 'styled-components'
65

76
import {
8-
ALIGN_CENTER,
97
BasicButton,
108
COLORS,
11-
CURSOR_POINTER,
12-
DIRECTION_COLUMN,
13-
Flex,
149
INFO_TOAST,
15-
JUSTIFY_CENTER,
1610
LargeButton,
17-
SPACING,
1811
StyledText,
1912
TYPOGRAPHY,
2013
} from '@opentrons/components'
@@ -32,8 +25,9 @@ import {
3225
localStorageAnnouncementKey,
3326
setLocalStorageItem,
3427
} from '../../persist'
28+
import styles from './Landing.module.css'
3529

36-
import type { ChangeEvent, ComponentProps } from 'react'
30+
import type { ChangeEvent } from 'react'
3731
import type { ThunkDispatch } from '../../types'
3832

3933
import welcomeImage from '../../assets/images/welcome_page.png'
@@ -80,7 +74,7 @@ export function Landing(): JSX.Element {
8074
setShowAnnouncementModal(true)
8175
},
8276
disableTimeout: true,
83-
justifyContent: JUSTIFY_CENTER,
77+
justifyContent: 'center',
8478
}
8579
)
8680
}
@@ -113,28 +107,15 @@ export function Landing(): JSX.Element {
113107
}}
114108
/>
115109
) : null}
116-
<Flex
117-
data-cy="landing-page"
118-
backgroundColor={COLORS.grey10}
119-
flexDirection={DIRECTION_COLUMN}
120-
alignItems={ALIGN_CENTER}
121-
justifyContent={JUSTIFY_CENTER}
122-
height="calc(100vh - 9rem)"
123-
width="100%"
124-
gridGap={SPACING.spacing32}
125-
>
126-
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing16}>
110+
<div data-cy="landing-page" className={styles.landingPage}>
111+
<div className={styles.contentSection}>
127112
<img
128113
src={welcomeImage}
129114
height="132px"
130115
width="548px"
131116
aria-label="welcome image"
132117
/>
133-
<Flex
134-
flexDirection={DIRECTION_COLUMN}
135-
gridGap={SPACING.spacing8}
136-
alignItems={ALIGN_CENTER}
137-
>
118+
<div className={styles.textSection}>
138119
<StyledText desktopStyle="headingLargeBold">
139120
{t('welcome')}
140121
</StyledText>
@@ -146,53 +127,34 @@ export function Landing(): JSX.Element {
146127
>
147128
{t('no-code-required')}
148129
</StyledText>
149-
</Flex>
150-
</Flex>
151-
<StyledNavLink to="/createNew">
130+
</div>
131+
</div>
132+
<NavLink to="/createNew" className={styles.navLink}>
152133
<LargeButton
153134
onClick={() => {
154135
dispatch(toggleNewProtocolModal(true))
155136
}}
156-
buttonText={<ButtonText>{t('create_a_protocol')}</ButtonText>}
137+
buttonText={
138+
<span className={styles.buttonText}>
139+
{t('create_a_protocol')}
140+
</span>
141+
}
157142
/>
158-
</StyledNavLink>
159-
<StyledLabel>
143+
</NavLink>
144+
<label className={styles.label}>
160145
<BasicButton onClick={handleImportClick} underLine>
161146
{t('import_existing_protocol')}
162147
</BasicButton>
163-
<StyledInput
148+
<input
164149
type="file"
165150
onChange={loadFile}
166151
ref={fileInputRef}
167152
aria-label={t('import')}
153+
className={styles.hiddenInput}
168154
/>
169-
</StyledLabel>
170-
</Flex>
155+
</label>
156+
</div>
171157
<EndUserAgreementFooter />
172158
</>
173159
)
174160
}
175-
176-
const StyledLabel = styled.label`
177-
display: inline-block;
178-
cursor: ${CURSOR_POINTER};
179-
input[type='file'] {
180-
display: none;
181-
}
182-
`
183-
184-
const ButtonText = styled.span`
185-
line-height: ${TYPOGRAPHY.lineHeight24};
186-
font-size: 1rem;
187-
font-style: normal;
188-
font-weight: ${TYPOGRAPHY.fontWeightSemiBold};
189-
`
190-
191-
const StyledNavLink = styled(NavLink)<ComponentProps<typeof NavLink>>`
192-
color: ${COLORS.white};
193-
text-decoration: none;
194-
`
195-
196-
const StyledInput = styled.input`
197-
display: none;
198-
`

yarn.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3786,7 +3786,6 @@
37863786
"@opentrons/step-generation" "link:step-generation"
37873787
"@thi.ng/paths" "1.6.5"
37883788
"@types/uuid" "^3.4.7"
3789-
classnames "2.2.5"
37903789
connected-react-router "6.9.3"
37913790
core-js "3.2.1"
37923791
date-fns "2.25.0"
@@ -8955,6 +8954,11 @@ [email protected]:
89558954
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d"
89568955
integrity sha512-DTt3GhOUDKhh4ONwIJW4lmhyotQmV2LjNlGK/J2hkwUcqcbKkCLAdJPtxQnxnlc7SR3f1CEXCyMmc7WLUsWbNA==
89578956

8957+
8958+
version "2.5.1"
8959+
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b"
8960+
integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==
8961+
89588962
89598963
version "4.2.1"
89608964
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17"

0 commit comments

Comments
 (0)