-
Notifications
You must be signed in to change notification settings - Fork 163
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
feat: Steps #2684
feat: Steps #2684
Conversation
src/steps/styles.scss
Outdated
|
||
> .step-details { | ||
align-items: center; | ||
font-size: awsui.$font-size-body-s; |
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.
font-size and color should not be set here. I'll remove this
import statusIconStyles from '../../../status-indicator/styles.selectors.js'; | ||
import testUtilStyles from '../../../steps/test-classes/styles.selectors.js'; | ||
|
||
export class StepWrapper extends ComponentWrapper { |
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.
This is WIP but any feedback regarding what selectors we should have is appreciated
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.
As a side note, for type changes to be reflected in documentation don't forget to build the package and then update the documenter snapshot
src/steps/internal.tsx
Outdated
|
||
const InternalStep = ({ status, statusIconAriaLabel, header, details }: StepsProps.Step) => { | ||
return ( | ||
<li className={clsx(styles['step-container'], testUtilStyles['step-container'])}> |
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.
You don't need separate classes. You can use the ones in styles
. One minor thing, you also don't need to append step-
to the beginning of each class name. Here you can simply use step
and below status
, header
, etc.
src/test-utils/dom/steps/index.ts
Outdated
} | ||
} | ||
export default class StepsWrapper extends ComponentWrapper { | ||
static rootSelector: string = testUtilStyles.steps; |
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.
The same case with my comment above, you don't need the testUtilStyles, here you can use styles.root
which is usually how it's defined for the other components as well.
src/steps/internal.tsx
Outdated
return ( | ||
<li className={clsx(styles['step-container'], testUtilStyles['step-container'])}> | ||
<div className={clsx(styles['step-status'], testUtilStyles['step-status'])}> | ||
<StatusIndicator type={status} iconAriaLabel={statusIconAriaLabel} /> |
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.
It seems that only icon is being used from status indicator? If we only want to get the icon then why not use the icon component?
Another question, do we expect the text to be the same color as the status icon? e.g. green when status is success?
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.
If we only want to get the icon then why not use the icon component?
Good point!
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.
Another question, do we expect the text to be the same color as the status icon? e.g. green when status is success?
That is really up to the consumer. There are use cases where consumers want to do that and others where they don't
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.
Let's discuss switching it to icon with Kashi as well. If it's an icon, we could even expose the other available icon names and custom icons through url or svg but there could be a specific reason why status indicator was chosen (which could be the point I brought up whether we expect text to be green, red, etc.)
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.
If we only want to get the icon then why not use the icon component?
I was looking into this and one issue is that the https://refresh.cloudscape.aws.dev/components/icon does not have Loading, so we would need to provide some custom logic for that. Because of that I would propose continuing with using the StatusIndicator. WDYT?
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.
Hmm true that is lacking but we can easily switch it with a spinner. Though it'd mean some API changes and implementation changes. I'd say you leave it as is right now and then we discuss with Kashi
package.json
Outdated
@@ -117,6 +117,7 @@ | |||
"prettier": "^3.2.5", | |||
"react": "^16.14.0", | |||
"react-dom": "^16.14.0", | |||
"react-markdown": "^8.0.7", |
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.
Do we really need this?
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.
Not really! I mostly added it because in Q we are gonna be using this so I wanted to validate it works as expected but I can replace it by something else and avoid adding a devDependency here
src/test-utils/dom/steps/index.ts
Outdated
findStatusIndicator(): ElementWrapper | null { | ||
return this.findByClassName(statusIconStyles.icon); | ||
} |
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.
I'm not sure how helpful this would be given it only is an icon
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.
Isn't it useful so that consumers can test that their expected status is there?
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.
Not really, this would only return an icon element which is alone not enough to communicate the status, besides it won't really indicate the status unless they depend on the class name which is not recommended. If you check status indicator, it also doesn't have a selector for the icon.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2684 +/- ##
=======================================
Coverage 96.15% 96.16%
=======================================
Files 756 759 +3
Lines 21303 21329 +26
Branches 6895 6896 +1
=======================================
+ Hits 20484 20510 +26
Misses 811 811
Partials 8 8 ☔ View full report in Codecov by Sentry. |
src/steps/internal.tsx
Outdated
return ( | ||
<div | ||
{...props} | ||
className={clsx(styles.root, styles.steps, props.className)} |
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.
props.className?
A minor point is that you don't need two separate classes root and steps, only root is enough
src/steps/__tests__/steps.test.tsx
Outdated
expect(wrapper.findItems()[3]!.findDetails()).toBeNull(); | ||
}); | ||
|
||
test('renders correct status icons', () => { |
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.
This test isn't needed, you are testing if status indicator is putting the icon and the test can't even know if they are correct. Visual aspects like this are tested via visual/screenshot tests
> :last-of-type > .connector { | ||
display: none; | ||
} |
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.
Could you check if screenreader is able to find this connector?
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.
Confirmed that it is not able to find it :)
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.
Tbh I don't think this page is needed we know the component will be updated when customer updates the steps. It also requires interactivity which won't do much for screenshot tests. I'd say the same thing for the interactive permutations.
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.
So I should just leave the regular permutations.page
right?
|
||
return ( | ||
<ScreenshotArea disableAnimations={false}> | ||
<article aria-live="polite"> |
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.
Can you confirm this announces every change in the steps?
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.
Confirmed :)
pages/steps/styles.scss
Outdated
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.
What is this file for?
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.
It contains the styles being used in the permutations page. I can remove it and make it inline css if you'd prefer
src/steps/interfaces.ts
Outdated
* Each step definition has the following properties: | ||
* * `status` (string) - Status of the step corresponding to a status indicator. | ||
* * `statusIconAriaLabel` - (string) - (Optional) Text alternative for the status icon. | ||
* * `header` (react.ReactNode) - Area next to the status indicator of the step. |
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.
just (ReactNode)
* * `header` (react.ReactNode) - Area next to the status indicator of the step. | |
* * `header` (ReactNode) - Area next to the status indicator of the step. |
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.
I think the description of header
could be improved too, maybe work with Kashi to align how it will be referred to in the usage guidelines
src/steps/internal.tsx
Outdated
|
||
export const InternalSteps = ({ steps, __internalRootRef, ...props }: InternalStepsProps) => { | ||
return ( | ||
<div |
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.
shouldn't these aria-*
properties be on the semantic element, i.e. the ol
?
successfulStepsInteractive, | ||
]; | ||
|
||
const [stepIndex2, setStepIndex2] = useState(0); |
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.
This can probably be refactored with a component that manages its own internal state independently, instead of managing 4 almost-identical states in a single component.
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.
That is true, but is it worth it at this point? :) It's just an example page
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.
Let's call this non-blocking but a suggestion. Always good to keep things simple for the next one who might work on it.
package-lock.json
Outdated
@@ -6817,108 +6817,6 @@ | |||
"integrity": "sha512-9rTIZ4ZjWwalCPiaY+kPiALLfOKgAz5CTi/Zb1L+qSZ8PH3zVo1T8JcgXIIqg1iM3pZ6hF+n9xO5r2jZ/SF+jg==", | |||
"dev": true | |||
}, | |||
"node_modules/devtools/node_modules/debug": { |
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.
Do you know why these changes in the package-lock.json
popped up? If not, can we exclude them from the PR?
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.
Excluded :)
src/steps/interfaces.ts
Outdated
* | ||
* Each step definition has the following properties: | ||
* * `status` (string) - Status of the step corresponding to a status indicator. | ||
* * `statusIconAriaLabel` - (string) - (Optional) Text alternative for the status icon. |
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.
"Text alternative" or "Alternative text"?
1686229
Description
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.