-
Notifications
You must be signed in to change notification settings - Fork 814
Improved dialog and docs + button loading #134
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
Conversation
| @@ -1,3 +1,4 @@ | |||
| /* eslint-disable react/no-danger */ | |||
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.
Why add this? I don't see dangerouslySetInnerHTML anywhere?
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
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 yeah removed that later.
| } | ||
| } | ||
| &:hover { | ||
| text-decoration: underline; |
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.
Might want a focus style too? 😉
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 was too lazy.
docs/src/css/main-layout.css
Outdated
| flex: 1; | ||
| display: flex; | ||
| background-color: var(--neutral-3); | ||
| /* background-color: var(--neutral-3); */ |
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.
Probably should just delete 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.
Yes
src/buttons/docs/LoadingManager.js
Outdated
| render() { | ||
| return this.props.children({ | ||
| isLoading: this.state.isLoading, | ||
| setLoading: () => { |
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 should really make this a method on the class and keep the JSX clean.
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.
Yes.
src/buttons/stories/index.stories.js
Outdated
| render() { | ||
| return this.props.children({ | ||
| isLoading: this.state.isLoading, | ||
| setLoading: () => { |
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.
Same here
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.
yes
src/dialog/docs/index.js
Outdated
| BlueprintJS | ||
| </a>{' '} | ||
| pointed out in their documentation that “modal” is a misnomer | ||
| for “dialog”. |
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.
Use “ and ” instead. Unicode is your friend. 😉
src/dialog/src/Dialog.js
Outdated
| * Children can be a node or a function accepting `({ close })`. | ||
| * See an example to understand how this works. | ||
| */ | ||
| children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), |
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.
Might be worth making children required because a dialog without children is pretty useless. 😛
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.
True
src/dialog/src/Dialog.js
Outdated
| * Passing this object will show the button and cancel button. | ||
| * You should pass `children` and `onClick`. | ||
| */ | ||
| primaryButton: PropTypes.object, |
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 it can't be boolean?
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.
Nope.
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.
Most of the time you wouldn't really want to pass props to the primary button though?
Then you'll end up with lots of code like primaryButton={{}}.
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 have to pass the onClick handler
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.
And you need to pass in children to give it a label. You always have to define something right?
| * This offset is also used at the bottom when there is not enough space | ||
| * available on screen — and the Dialog scrolls internally. | ||
| */ | ||
| topOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), |
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't be a number because I don't think unitless values will work in the CSS calc below.
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.
Ah, we need to do add px then.
src/dialog/src/Dialog.js
Outdated
| : close() | ||
| } | ||
| /> | ||
| {hideCancelButton ? null : ( |
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 do {!hideCancelButton && (.
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.
Yes
* improved dialog and docs + button loading * fixes * fix build * more explicit API * intent => type keep consistent with Alert * update story and docs * removed old showCancel * docs fixes
This PR is based on top of #127, #128. The other PR was still based on the old mono-repo, so I redid most what was in that PR and made some additional changes and tweaks.
This is a breaking change
This PR contains
isLoadingpropProps and default props
Design Examples
These examples don‘t reflect the latest state of the component.