8000 feat(wizard): add wizard step status by srambach · Pull Request #6447 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

feat(wizard): add wizard step status#6447

Merged
mcoker merged 2 commits intopatternfly:v6from
srambach:5142-add-wizard-step-status
May 2, 2024
Merged

feat(wizard): add wizard step status#6447
mcoker merged 2 commits intopatternfly:v6from
srambach:5142-add-wizard-step-status

Conversation

@srambach
Copy link
Member

Fixes #5142

This adds an icon element and styles it to appear where the step number currently appears (hiding the step number if so).
A new modifier is added for danger status.
A new full page example is added to wizard.

The size of the step number was adjusted to match the xl icon size per @lboehling

@srambach srambach requested review from a team, mattnolting and mcoker and removed request for a team March 19, 2024 21:05
@mcoker mcoker changed the title 5142 add wizard step status fix(wizard): add wizard step status Mar 19, 2024
@mcoker mcoker changed the title fix(wizard): add wizard step status feat(wizard): add wizard step status Mar 19, 2024
@patternfly-build
Copy link
Collaborator
patternfly-build commented Mar 19, 2024

@@ -0,0 +1,6 @@
<span class="{{pfv}}wizard__nav-link-icon{{#if wizard-nav-link-icon--modifier}} {{wizard-nav-link-icon--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might rename this from icon to status-icon, just so we can leave room for a step icon that we can target uniquely from the status icon and not run into a namespace issue. WDYT?


// Nav link status icon
--# 10BC0 {$wizard}__nav-link-icon--Color: var(--pf-t--global--icon--color--regular);
--#{$wizard}__nav-link--m-danger--nav-link-icon--Color: var(--pf-t--global--icon--color--status--danger--default);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically I think you'd use --m-danger__nav-link-icon (since it's a nested element) but since the var starts at __nav-link I think you'd also be alright just calling this __icon if you wanted to shorten the var.

Suggested change
--#{$wizard}__nav-link--m-danger--nav-link-icon--Color: var(--pf-t--global--icon--color--status--danger--default);
--#{$wizard}__nav-link--m-danger__icon--Color: var(--pf-t--global--icon--color--status--danger--default);

@srambach srambach linked an issue Mar 20, 2024 that may be closed by this pull request
Copy link
Contributor
@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to replace how React currently renders error icons in the step error status example I assume?

Comment on lines +468 to +486
&::before {
// display: none;
opacity: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we want to use the opacity or display property here?

Comment on lines +45 to +47
{{#> wizard-nav-link-status-icon}}
<i class="fas fa-exclamation-circle" aria-hidden="true"></i>
{{/wizard-nav-link-status-icon}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker here but something that might be good to do in the future, but instead of having to pass an icon to the status icon, maybe just rendering whatever icon in the status icon handlebars (instead of a partial-block) based on Is[status]

{{#> wizard-toggle}}
{{#> wizard-toggle-list}}
{{#> wizard-toggle-list-item wizard-toggle-list-item--modifier='pf-m-danger'}}
{{#> wizard-toggle-status-icon}}<i class="fas fa-exclamation-circle" aria-hidden="true"></i>{{/wizard-toggle-status-icon}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above comment that was resolved, not a blocker but could render the icon inside wizard-toggle-status-icon rather than needing to pass it in examples. Maybe even rendering the status icon inside of toggle-list-item when isDanger=true?

Comment on lines +474 to +475
{{#> wizard-toggle-list-item}}
{{#> wizard-toggle-num}}2{{/wizard-toggle-num}}
Configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this list item needs the status icon passed in as well. On wider viewport the 2nd step has an error icon, but on smaller viewport the toggle doesn't show the error icon. That or the 2nd step for desktop view should have the error icon removed (so that only the 1st step has an error).

Wider viewport:

image

Smaller viewport:

image

@srambach srambach force-pushed the 5142-add-wizard-step-status branch from de5a1cc to dc3604d Compare April 10, 2024 20:37
@srambach srambach requested a review from thatblindgeye April 10, 2024 20:46
Copy link
Contributor
@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a followup in React to adjust the error styling there to match, but otherwise looks good

Copy link
Contributor
@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woot! Left some comments, lemme know what ya think!

.#{$wizard}__nav-link-main {
display: flex;
flex-grow: 1;
justify-content: space-between;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this since there will always be nav-link-text, and it's set to flex-grow

.#{$wizard}__nav-link-text {
flex-grow: 1;
}

--#{$wizard}__nav-link-status-icon--Color: var(--#{$wizard}__nav-link--m-danger__nav-link-status-icon--Color);

&::before {
display:none;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤓

Suggested change
display:none;
display: none;

border-radius: var(--#{$wizard}__nav-link--BorderRadius);
}

.#{$wizard}__nav-link-status-icon {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note about the font awesome status icons is that the warning-triangle icon is wider than the icons we use for success/danger, so if we put a warning icon by a step name, that step text will be pushed over farther than the step text above/below it. It's not a huge issue since the icons in react are square, and most users will use those, but if a user supplied their own icon that wasn't a square, that may cause an issue.

I wonder if this element should share the shape size we define for the count circles, or we should reconsider using absolute positioning/translate here like it was before. Or possibly use subgrid for the number/status icon, though worth noting the column width would shift for all steps if a wider status icon was added to a step.

Screenshot 2024-04-18 at 5 07 06 PM Screenshot 2024-04-18 at 5 12 14 PM Screenshot 2024-04-18 at 5 12 22 PM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcoker Can we defer this pending a decision about the new icon set?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good plan 👍


### Error on step
```hbs isFullscreen
{{#> wizard wizard--id="wizard-basic"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{#> wizard wizard--id="wizard-basic"}}
{{#> wizard wizard--id="wizard-error-on-step"}}


### Nav expanded with error (mobile)
```hbs isFullscreen
{{#> wizard wizard--IsExpanded="true"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're missing a wizard--id here and in the OG expanded example

{{#> wizard wizard--IsExpanded="true"}}

Would you mind adding one here and in the other example? That's used for a few things, including the form that gets added to these wizards

Screenshot 2024-04-18 at 5 23 13 PM

@@ -0,0 +1,6 @@
<span class="{{pfv}}wizard__nav-link-main{{#if wizard-nav-link-main--modifier}} {{wizard-nav-link-main--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add this element to the component docs?

| `.pf-m-expanded` | `.pf-v6-c-wizard__nav-item` | Modifies a nav item for the expanded state. |
| `.pf-m-current` | `.pf-v6-c-wizard__nav-link` | Modifies a step link for the current state. **Required** |
| `.pf-m-disabled` | `.pf-v6-c-wizard__nav-link` | Modifies a step link for the disabled state. |
| `.pf-m-danger` | `.pf-v6-c-wizard__nav-link` | Modifies a step link to indicate danger status. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you can also add it to the list-item in the mobile nav

Suggested change
| `.pf-m-danger` | `.pf-v6-c-wizard__nav-link` | Modifies a step link to indicate danger status. |
| `.pf-m-danger` | `.pf-v6-c-wizard__nav-link`, `pf-v6-c-wizard__toggle-list-item` | Modifies a step link to indicate danger status. |

--#{$wizard}__nav-link-status-icon--LineHeight: 1;
--#{$wizard}__toggle-status-icon--Color: var(--pf-t--global--icon--color--regular);
--#{$wizard}__toggle--m-danger__nav-link-status-icon--Color: var(--pf-t--global--icon--color--status--danger--default);
--#{$wizard}__toggle-status-icon--Top: calc(var(--pf-t--global--spacer--xs) / 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be wrong here, but it looks like this use of spacer--xs doesn't correspond with alignging the status-icon with something else that uses spacer--xs as a top spacer... this calc just returns 2px which looks to be about the adjustment that works visually to center the icon? If so, I might just use 2px here instead? It's really a nit, but if a user (or we as PF) themed/customized spacer--xs for a compact theme or whatever, I don't think we would want this value to change necessarily. I think the same comment applies to

--#{$wizard}__nav-link-status-icon--Top: var(--pf-t--global--spacer--xs);

Kind of a philosophical question around using a token because it gives the look you're going for, versus it being the right token given the token's meaning. Since our spacer tokens are so generic, I don't think it matters, but figured I'd leave a comment for light reading 😅

Comment on lines +516 to +522
padding-block-start: var(--#{$wizard}__nav-link--PaddingBlockStart);
padding-block-end: var(--#{$wizard}__nav-link--PaddingBlockEnd);
padding-inline-start: var(--#{$wizard}__nav-link--PaddingInlineStart);
padding-inline-end: var(--#{$wizard}__nav-link--PaddingInlineEnd);
background-color: var(--#{$wizard}__nav-link--BackgroundColor);
border: none;
border-radius: var(--#{$wizard}__nav-link--BorderRadius);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we rename these?

Suggested change
padding-block-start: var(--#{$wizard}__nav-link--PaddingBlockStart);
padding-block-end: var(--#{$wizard}__nav-link--PaddingBlockEnd);
padding-inline-start: var(--#{$wizard}__nav-link--PaddingInlineStart);
padding-inline-end: var(--#{$wizard}__nav-link--PaddingInlineEnd);
background-color: var(--#{$wizard}__nav-link--BackgroundColor);
border: none;
border-radius: var(--#{$wizard}__nav-link--BorderRadius);
padding-block-start: var(--#{$wizard}__nav-link-main--PaddingBlockStart);
padding-block-end: var(--#{$wizard}__nav-link-main--PaddingBlockEnd);
padding-inline-start: var(--#{$wizard}__nav-link-main--PaddingInlineStart);
padding-inline-end: var(--#{$wizard}__nav-link-main--PaddingInlineEnd);
background-color: var(--#{$wizard}__nav-link-main--BackgroundColor);
border: none;
border-radius: var(--#{$wizard}__nav-link-main--BorderRadius);

@mcoker mcoker force-pushed the 5142-add-wizard-step-status branch from b21ed86 to 139060e Compare May 2, 2024 15:55
Copy link
Contributor
@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@mcoker mcoker merged commit 9a869f8 into patternfly:v6 May 2, 2024
@patternfly-build
DF80 Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.123 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wizard - support for step status

4 participants

0