Skip to content
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

Allowing more status options for EuiSteps #1088

Merged
merged 5 commits into from
Aug 7, 2018

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Aug 6, 2018

Fixes #994

A while back we added the option for a "completion" step, but it had only one option which was "complete" with a checkmark. I've noticed in some implementations of EuiSteps the last step can have an error or warning like so:

image


I separated the actual step number render from both EuiStep and EuiStepHorizontal into EuiStepNumber which allows for these status options: 'incomplete', 'complete', 'disabled', 'danger', 'warning'.

I purposefully did not add this new EuiStepNumber component to the index.js manifest as it's just a dependency of EuiSteps and EuiStepsHorizontal and should not be used on it's own.

Also, there is some odd-ish logic happening in EuiStepHorizontal because of the way the component was already handling it's own status and I didn't want to cause any breaking changes.


Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Small comment about docs, naming. I checked code and tested this locally. I also verified this would be a non-breaking change based upon our previous interface.

}

&--complete {
.euiStepNumber__icon path {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might wanna comment this one to explain why you're targeting the innards of the svg.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@snide So that's how I had to do it because the icon itself uses the <defs> and <use> that really aren't necessary. Are you ok with me modifying the svg itself?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, yeah. I know why you're doing it and its fine to do it this way. Just think it's a little off pattern so you should probably comment the markup to explain why you're doing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah but I'm thinking it's bad to be doing it this way and the svg itself should be written correctly versus hacking it here.

});
}

handleUncomplete() {
Copy link
Contributor

Choose a reason for hiding this comment

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

handleIncomplete? I guess it's "un" completing it. Words are hard.

EuiIcon,
} from '../icon';

const statusToClassNameMap = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Know a lot of this is baked into not wanting this to be a breaking change (meaning I should have named complete as success...etc), but i wish this map read a little more as a set. Tempted to say warning / danger here should instead be "alert" and "error" so they all read the same and it doesn't feel tied to our coloring system (since this forces the actual icon usage as well).

I don't think it matters much, but just something I noticed when looking at the code.

In either case, can you update the doc description to make it more readible what it accepts. Can do that either by including the new component in the prop docs and referencing it, or just writing them in in the description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Referencing these docs if that wasn't clear.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I wish the auto-doc props list would be able to list imported constants here.

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes LGTM; pulled branch and played with the docs; I echo Dave's thoughts about that status prop, but know you guys talked about it and are trying to avoid breaking changes with it 👍

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.

3 participants