-
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
Merged
NatSquared
merged 15 commits into
main
from
feature/DESENG-663-engagement-authoring-wizard-design-compliance
Aug 13, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
180e512
Implement UX designs for engagement wizard
NatSquared e3676c2
Fix sonarcloud issues: 1/?
NatSquared 8581f7b
Update unit tests
NatSquared 9a45ed2
Update unit tests again
NatSquared fa0d5cb
Un-invert required options in multi-select
NatSquared 2313395
Specify Language type on language manager
NatSquared 578a399
Update common component documentation
NatSquared 970b869
Make suggested accessibility changes
NatSquared c283c9e
change aria-label
NatSquared f8962f0
Merge branch 'main' into feature/DESENG-663-engagement-authoring-wiza…
NatSquared 286b3e0
Change to new folder structure
NatSquared 59c0fa7
Sonarcloud suggestion - use <fieldset> instead of role=group
NatSquared 417f194
bugfix :<
NatSquared 68dae10
don't export the circleNumberIcons
NatSquared 71839a6
Fix fieldset styling issue in some browsers
NatSquared File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
met-web/src/components/common/Communication/StatusIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import React, { useId } 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'; | ||
|
||
const circleNumberIcons = [ | ||
faCircle1, | ||
faCircle2, | ||
faCircle3, | ||
faCircle4, | ||
faCircle5, | ||
faCircle6, | ||
faCircle7, | ||
faCircle8, | ||
faCircle9, | ||
]; | ||
|
||
export const FormStep = ({ | ||
step, | ||
completing, | ||
completed, | ||
question, | ||
details, | ||
labelFor, | ||
isGroup, | ||
children, | ||
}: { | ||
step: number; | ||
completing?: boolean; | ||
completed?: boolean; | ||
question?: string; | ||
details?: string; | ||
labelFor?: string; | ||
isGroup?: boolean; | ||
children?: React.ReactNode; | ||
}) => { | ||
const [isFocused, setIsFocused] = React.useState(false); | ||
const activityColor = completed || completing || isFocused ? colors.surface.blue[90] : colors.surface.gray[70]; | ||
const titleId = useId(); | ||
const instructionsId = useId(); | ||
|
||
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" | ||
component={isGroup ? 'fieldset' : 'div'} | ||
aria-labelledby={titleId + ' ' + instructionsId} | ||
sx={{ border: 'none' }} | ||
> | ||
<Grid item xs={12}> | ||
<Header2 sx={{ mt: 0, fontSize: '20px', fontWeight: '300' }}> | ||
<label htmlFor={isGroup ? undefined : labelFor} id={titleId}> | ||
{question} | ||
</label> | ||
</Header2> | ||
</Grid> | ||
{details && ( | ||
<Grid item sx={{ marginTop: '-0.5rem', marginBottom: '1.5rem' }}> | ||
<BodyText size="small"> | ||
<label htmlFor={isGroup ? undefined : labelFor} id={instructionsId}> | ||
{details} | ||
</label> | ||
</BodyText> | ||
</Grid> | ||
)} | ||
<Grid item xs={12}> | ||
{children} | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!