Skip to content

Commit 0afb3bb

Browse files
fix: Design Fit and Finish (#193)
1 parent dd9c953 commit 0afb3bb

7 files changed

Lines changed: 142 additions & 130 deletions

File tree

core-sdk-samples/higgs-shop-sample-app/src/components/APIKeyModal/APIKeyEntryModal.test.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ describe('API Key Entry Modal', () => {
3131
name: /learn/i,
3232
});
3333

34-
const keyTextField = screen.getByRole('textbox', {
35-
name: /key/i,
36-
});
34+
const keyTextField = screen.getByTestId('apiKey-entry');
3735

3836
const saveAndGoButton = screen.getByRole('button', {
3937
name: 'Save & Go',
@@ -55,19 +53,15 @@ describe('API Key Entry Modal', () => {
5553
<APIKeyEntryModal isOpen initialKey='XXXXXX' />,
5654
);
5755

58-
const keyTextField = screen.getByRole('textbox', {
59-
name: /key/i,
60-
});
56+
const keyTextField = screen.getByTestId('apiKey-entry');
6157

6258
expect(keyTextField).toHaveValue('XXXXXX');
6359
});
6460

6561
test('should enable Save & Go button if API Key is Entered', async () => {
6662
renderWithAPIKeyContext(<APIKeyEntryModal isOpen />);
6763

68-
const keyTextField = screen.getByRole('textbox', {
69-
name: /key/i,
70-
});
64+
const keyTextField = screen.getByTestId('apiKey-entry');
7165

7266
const saveAndGoButton = screen.getByRole('button', {
7367
name: 'Save & Go',
@@ -83,9 +77,7 @@ describe('API Key Entry Modal', () => {
8377
test('should close only if API Key is entered and reload window', async () => {
8478
renderWithAPIKeyContext(<APIKeyEntryModal isOpen />);
8579

86-
const keyTextField = screen.getByRole('textbox', {
87-
name: /key/i,
88-
});
80+
const keyTextField = screen.getByTestId('apiKey-entry');
8981

9082
const saveAndGoButton = screen.getByRole('button', {
9183
name: 'Save & Go',

core-sdk-samples/higgs-shop-sample-app/src/components/APIKeyModal/APIKeyEntryModal.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,31 @@ const APIKeyEntryModal: React.FC<APIKeyEntryModalProps> = ({
8787
</Grid>
8888
<Grid item>
8989
<DialogContent>
90-
<Typography variant='body1' align='center'>
90+
<Typography
91+
variant='body1'
92+
align='center'
93+
sx={{
94+
fontSize: '14px',
95+
fontWeight: '700',
96+
lineHeight: '20px',
97+
letterSpacing: '0.13px',
98+
}}
99+
>
91100
To get started, add the web key you generated in
92101
mParticle to connect this sample app to your account.
93102
</Typography>
94103
</DialogContent>
95104
</Grid>
96105
<Grid item xs={12} sx={{ width: '100%' }}>
97-
<DialogContent>
106+
<DialogContent sx={{ py: 0 }}>
98107
<FormControl fullWidth focused required>
99108
<TextField
100109
id='apiKey'
101-
label='Key'
110+
// Use inputProps to target for testing because of Material UI's
111+
// component abstraction and because we are not using a label
112+
// to fetch via getByRole
113+
// https://stackoverflow.com/questions/57110557/react-testing-library-the-given-element-does-not-have-a-value-setter-when-firee
114+
inputProps={{ 'data-testid': 'apiKey-entry' }}
102115
value={currentAPIKey}
103116
placeholder='Paste your Key here'
104117
onChange={(e) => setCurrentAPIKey(e.target.value)}

core-sdk-samples/higgs-shop-sample-app/src/components/APIKeyModal/APIKeyEnvMessageModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ const APIKeyEnvMessageModal: React.FC<APIKeyEnvMessageModalProps> = ({
2121
buttonAction={
2222
<>
2323
<Button
24-
variant='contained'
24+
variant='outlined'
2525
target='_blank'
26-
href={SAMPLE_APP_README_GITHUB_REPOSITORY_URL}
26+
href={DOCSITE_API_KEY_QUICKSTART}
2727
>
28-
Go to Readme
28+
Go to Docs
2929
</Button>
3030
<Button
3131
variant='contained'
3232
target='_blank'
33-
href={DOCSITE_API_KEY_QUICKSTART}
33+
href={SAMPLE_APP_README_GITHUB_REPOSITORY_URL}
3434
>
35-
Go to Docs
35+
Go to Readme
3636
</Button>
3737
</>
3838
}

core-sdk-samples/higgs-shop-sample-app/src/components/MessageModal/MessageModal.tsx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Dialog,
33
DialogActions,
44
DialogContent,
5+
Grid,
56
Typography,
67
} from '@mui/material';
78
import React from 'react';
@@ -18,12 +19,30 @@ const MessageModal: React.FC<MessageModalProps> = ({
1819
}) => {
1920
return (
2021
<Dialog open={open}>
21-
<DialogContent>
22-
<Typography variant='body1' align='center'>
23-
{message}
24-
</Typography>
25-
</DialogContent>
26-
{buttonAction && <DialogActions>{buttonAction}</DialogActions>}
22+
<Grid
23+
container
24+
columns={1}
25+
spacing={2}
26+
sx={{
27+
display: 'flex',
28+
flexDirection: 'column',
29+
alignItems: 'center',
30+
justifyContent: 'center',
31+
}}
32+
>
33+
<Grid item>
34+
<DialogContent>
35+
<Typography variant='body1' align='center'>
36+
{message}
37+
</Typography>
38+
</DialogContent>
39+
</Grid>
40+
{buttonAction && (
41+
<Grid item>
42+
<DialogActions>{buttonAction}</DialogActions>
43+
</Grid>
44+
)}
45+
</Grid>
2746
</Dialog>
2847
);
2948
};

core-sdk-samples/higgs-shop-sample-app/src/components/NavigationMenu/NavigationMenu.tsx

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -160,28 +160,15 @@ const NavigationMenu: React.FC = () => {
160160
// The following desktop navigation items use mParticle.logEvent
161161
// internally so that they stay DRY and handle optional callbacks.
162162
const topNavDesktopItems: ReactElement[] = [
163-
// Space for missing About Us section
164-
<Box key='spacer' sx={{ width: '220px' }} />,
165-
166163
<NavigationMenuItem
167164
testId='desktop-nav-shop-button'
168165
component={Link}
169166
to='/shop'
170167
sx={classes.link}
171-
label='Shop'
168+
label='Shop All'
172169
key='Shop'
173170
/>,
174171

175-
// Hide until About us content is available
176-
// <NavigationMenuItem
177-
// testId='desktop-nav-about-button'
178-
// component={Link}
179-
// to='/about'
180-
// sx={classes.link}
181-
// label='About'
182-
// key='About'
183-
// />,
184-
185172
<MenuItem
186173
data-testid='desktop-nav-home-button'
187174
aria-label='Desktop Home Page'
@@ -193,15 +180,18 @@ const NavigationMenu: React.FC = () => {
193180
<HiggsmartLogo />
194181
</MenuItem>,
195182

196-
<NavigationMenuItem
197-
testId='desktop-nav-account-button'
183+
<IconButton
184+
aria-label='Account'
185+
data-testid='desktop-nav-account-button'
198186
component={Link}
199-
to='/account'
187+
to='/Account'
200188
sx={classes.link}
201-
label='Account'
202-
iconLeft={<PersonIcon sx={classes.topnavLinkIcon} />}
203189
key='Account'
204-
/>,
190+
>
191+
<Badge color='primary'>
192+
<PersonIcon sx={classes.topnavLinkIcon} />
193+
</Badge>
194+
</IconButton>,
205195

206196
<IconButton
207197
aria-label='Cart'
@@ -229,18 +219,6 @@ const NavigationMenu: React.FC = () => {
229219
iconLeft={<CheckroomIcon sx={classes.drawerLinkIcon} />}
230220
/>,
231221

232-
// Hide until About us content is available
233-
// <NavigationMenuItem
234-
// testId='drawer-nav-about-button'
235-
// key='about'
236-
// component={Link}
237-
// to='/about'
238-
// sx={classes.drawerLink}
239-
// clickCallback={closeDrawer}
240-
// label='About'
241-
// iconLeft={<InfoIcon sx={classes.drawerLinkIcon} />}
242-
// />,
243-
244222
<NavigationMenuItem
245223
testId='drawer-nav-account-button'
246224
key='account'

core-sdk-samples/higgs-shop-sample-app/src/contexts/theme.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ const theme = createTheme({
3030
lineHeight: '56px',
3131
textAlign: 'center',
3232
},
33+
h4: {
34+
color: '#FFFFFF',
35+
fontFamily,
36+
fontStyle: 'normal',
37+
fontWeight: 800,
38+
fontSize: '34px',
39+
lineHeight: '36px',
40+
textAlign: 'center',
41+
},
3342
h5: {
3443
color: '#FFFFFF',
3544
fontFamily,

0 commit comments

Comments
 (0)