-
Notifications
You must be signed in to change notification settings - Fork 19
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
[To Main] Implement UX designs for engagement wizard #2573
Changes from 6 commits
180e512
e3676c2
8581f7b
9a45ed2
fa0d5cb
2313395
578a399
970b869
c283c9e
f8962f0
286b3e0
59c0fa7
417f194
68dae10
71839a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome'; | ||
import { | ||
faInfoCircle, | ||
faExclamationTriangle, | ||
faExclamationCircle, | ||
faCheckCircle, | ||
} from '@fortawesome/pro-solid-svg-icons'; | ||
import { | ||
faInfoCircle as faInfoCircleRegular, | ||
faExclamationTriangle as faExclamationTriangleRegular, | ||
faExclamationCircle as faExclamationCircleRegular, | ||
faCheckCircle as faCheckCircleRegular, | ||
} from '@fortawesome/pro-regular-svg-icons'; | ||
import { | ||
faCheckCircle as faCheckCircleLight, | ||
faExclamationCircle as faExclamationCircleLight, | ||
faExclamationTriangle as faExclamationTriangleLight, | ||
faInfoCircle as faInfoCircleLight, | ||
} from '@fortawesome/pro-light-svg-icons'; | ||
|
||
import { colors } from 'styles/Theme'; | ||
|
||
type IconWeight = 'solid' | 'regular' | 'light'; | ||
|
||
export const StatusIcon = ({ | ||
status, | ||
color, | ||
weight = 'solid', | ||
...props | ||
}: { | ||
status: 'success' | 'warning' | 'error' | 'info'; | ||
color?: string; | ||
weight?: IconWeight; | ||
} & Partial<FontAwesomeIconProps>) => { | ||
let iconMap = { | ||
success: faCheckCircle, | ||
warning: faExclamationTriangle, | ||
error: faExclamationCircle, | ||
info: faInfoCircle, | ||
}; | ||
if (weight === 'regular') { | ||
iconMap = { | ||
success: faCheckCircleRegular, | ||
warning: faExclamationTriangleRegular, | ||
error: faExclamationCircleRegular, | ||
info: faInfoCircleRegular, | ||
}; | ||
} | ||
if (weight === 'light') { | ||
iconMap = { | ||
success: faCheckCircleLight, | ||
warning: faExclamationTriangleLight, | ||
error: faExclamationCircleLight, | ||
info: faInfoCircleLight, | ||
}; | ||
} | ||
|
||
return <FontAwesomeIcon icon={iconMap[status]} color={color ?? colors.notification[status].icon} {...props} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import React from 'react'; | ||
import { Box, Grid } from '@mui/material'; | ||
import { | ||
faCircle1, | ||
faCircle2, | ||
faCircle3, | ||
faCircle4, | ||
faCircle5, | ||
faCircle6, | ||
faCircle7, | ||
faCircle8, | ||
faCircle9, | ||
} from '@fortawesome/pro-regular-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faCircleCheck } from '@fortawesome/free-solid-svg-icons'; | ||
import { colors } from 'styles/Theme'; | ||
import { BodyText, Header2 } from '../Typography'; | ||
|
||
export const circleNumberIcons = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does |
||
faCircle1, | ||
faCircle2, | ||
faCircle3, | ||
faCircle4, | ||
faCircle5, | ||
faCircle6, | ||
faCircle7, | ||
faCircle8, | ||
faCircle9, | ||
]; | ||
|
||
export const FormStep = ({ | ||
step, | ||
completing, | ||
completed, | ||
question, | ||
details, | ||
children, | ||
}: { | ||
step: number; | ||
completing?: boolean; | ||
completed?: boolean; | ||
question?: string; | ||
details?: string; | ||
children?: React.ReactNode; | ||
}) => { | ||
const [isFocused, setIsFocused] = React.useState(false); | ||
const activityColor = completed || completing || isFocused ? colors.surface.blue[90] : colors.surface.gray[70]; | ||
|
||
return ( | ||
<Grid | ||
onFocus={() => setIsFocused(true)} | ||
onBlur={() => setIsFocused(false)} | ||
container | ||
direction="row" | ||
justifyContent="flex-start" | ||
alignItems="stretch" | ||
spacing={1} | ||
sx={{ | ||
padding: '1rem', | ||
backgroundColor: 'white', | ||
marginBottom: '1rem', | ||
maxWidth: '100%', | ||
}} | ||
> | ||
<Grid | ||
item | ||
container | ||
alignItems="stretch" | ||
direction="column" | ||
gap={1} | ||
sx={{ pt: 1.25, fontSize: '16px', width: '3rem' }} | ||
> | ||
<Grid item> | ||
<FontAwesomeIcon | ||
icon={completed ? faCircleCheck : circleNumberIcons[step - 1]} | ||
color={activityColor} | ||
size="2x" | ||
/> | ||
</Grid> | ||
<Grid item xs> | ||
<Box | ||
sx={{ | ||
height: '100%', | ||
width: '1rem', | ||
borderRight: '1px solid', | ||
borderColor: activityColor, | ||
}} | ||
/> | ||
</Grid> | ||
</Grid> | ||
<Grid item container xs justifyContent="flex-start" alignItems="flex-start" pb="16px"> | ||
<Grid item xs={12}> | ||
<Header2 sx={{ mt: 0, fontSize: '20px', fontWeight: '300' }}>{question}</Header2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice that you've built this handy modular component for the "step" style fields! Can we modify this slightly so that nonsighted users get all the same nice instructions as sighted users? There are multiple ways this could be done but we should definitely use a label tag somewhere and make sure it's tied to the right form field. This WCAG resource states we should ideally have a |
||
</Grid> | ||
{details && ( | ||
<Grid item sx={{ marginTop: '-0.5rem', marginBottom: '1.5rem' }}> | ||
<BodyText size="small">{details}</BodyText> | ||
</Grid> | ||
)} | ||
<Grid item xs={12}> | ||
{children} | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { Button, Grid, GridProps } from '@mui/material'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { StatusIcon } from '../Communication/StatusIcon'; | ||
import { colors } from 'styles/Theme'; | ||
import { faClose } from '@fortawesome/pro-regular-svg-icons'; | ||
|
||
export const SystemMessage = ({ | ||
status, | ||
onDismiss, | ||
color, | ||
coloredBackground, | ||
icon, | ||
children, | ||
...props | ||
}: { | ||
status: 'success' | 'warning' | 'error' | 'info'; | ||
onDismiss?: () => void; | ||
color?: string; | ||
coloredBackground?: boolean; | ||
icon?: string; | ||
} & GridProps) => { | ||
return ( | ||
<Grid | ||
container | ||
direction="row" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
sx={{ | ||
maxWidth: { xs: '100%', md: '700px' }, | ||
borderRadius: '8px', | ||
backgroundColor: coloredBackground ? colors.notification[status].tint : 'transparent', | ||
color: 'type.primary', | ||
padding: '0.8rem 1rem', | ||
paddingLeft: { xs: '0.5rem', md: '1rem' }, | ||
border: `1px solid ${colors.notification[status].shade}`, | ||
flexWrap: 'nowrap', | ||
...props.sx, | ||
}} | ||
> | ||
<Grid item sx={{ pr: 1, mt: -0.5, fontSize: '18px' }}> | ||
<StatusIcon status={status} color={color} /> | ||
</Grid> | ||
<Grid item sx={{ width: '100%', maxWidth: { xs: '100%', md: '600px', fontSize: '14px' } }}> | ||
{children} | ||
</Grid> | ||
<Grid item justifySelf="flex-end" sx={{ mt: -0.75, opacity: onDismiss ? 1 : 0 }}> | ||
<Button | ||
disabled={!onDismiss} | ||
onClick={onDismiss} | ||
sx={{ | ||
padding: 0, | ||
height: '100%', | ||
width: '32px', | ||
minWidth: '24px', | ||
marginTop: '8px', | ||
backgroundColor: 'transparent', | ||
color: colors.notification[status].icon, | ||
'&:hover': { | ||
backgroundColor: 'transparent', | ||
}, | ||
}} | ||
startIcon={<FontAwesomeIcon icon={faClose} />} | ||
></Button> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thanks for this!