-
Notifications
You must be signed in to change notification settings - Fork 29
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: add <InfoDialog> #367
Conversation
f35d518
to
25c48f6
Compare
import InfoDialog from './info-dialog'; | ||
|
||
const DialogController = props => { | ||
const [isOpen, toggle] = React.useState(false); |
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 wouldn't do this even though I like it. That means anybody building an app with our application-components needs to be on the latest React version. Not that it's unlikely but it's a bit of a harsh restriction balancing the benefit of it (mainly being funky) 😄
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 just the story for storybook, I don't think it's a problem to be honest.
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. Missed that. All good then. But it is worthwhile being on the lookout 😁
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.
Our first hook component 🥺
justifyContent: 'center', | ||
height: '100%', | ||
width: '100%', | ||
}} |
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.
Sorry, can we extract this? Either in a .mod.css or emotion. I don't feel like we have a rule for inline styles apart from: "it's not that much this time is 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.
We plan to migrate to emotion, so this is just temporary.
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 also don't mind using inline styles in stories.
@emmenko I would think it being helpful for other teams to also review this? So they know about the package, what's going on etc? Maybe just assign somebody from another team? |
packages/application-components/src/components/dialogs/info-dialog/info-dialog.js
Outdated
Show resolved
Hide resolved
packages/application-components/src/components/dialogs/info-dialog/README.md
Outdated
Show resolved
Hide resolved
packages/application-components/src/components/dialogs/info-dialog/README.md
Outdated
Show resolved
Hide resolved
packages/application-components/src/components/dialogs/info-dialog/README.md
Outdated
Show resolved
Hide resolved
packages/application-components/src/components/dialogs/info-dialog/info-dialog.js
Outdated
Show resolved
Hide resolved
{props.title} | ||
</Text.Subheadline> | ||
<SecondaryIconButton | ||
label="Close 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.
shouldn't this be translated?
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.
Maybe...maybe not. It's just for a11y.
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 am fine with having it untranslated for now.
packages/application-components/src/components/dialogs/info-dialog/info-dialog.js
Outdated
Show resolved
Hide resolved
justifyContent: 'center', | ||
height: '100%', | ||
width: '100%', | ||
}} |
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 also don't mind using inline styles in stories.
export { default as PageNotFound } from './components/page-not-found'; | ||
|
||
// Dialogs | ||
export { default as InfoDialog } from './components/dialogs/info-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.
nice! not forgetting the export 💯
packages/application-components/src/components/dialogs/info-dialog/info-dialog.js
Outdated
Show resolved
Hide resolved
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.
Looks good. Only one question.
); | ||
InfoDialog.displayName = 'InfoDialog'; | ||
InfoDialog.propTypes = { | ||
title: PropTypes.string.isRequired, |
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.
Should we make this a node
? This would require anybody to use formatMessage
and apply the HoC over just rendering a <FormattedMessage />
?
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 had it as a node
initially but @montezume asked to make it a string
, because the value is also used for the HTML title
attribute (which can only be a string).
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.
Okay, sorry missed that. All good then.
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.
All looks good to me 👍 ! So cool that we have more a more components moved to application-kit so they can be reused 🔝
Left some questions, but for me this fine to 👌
import styles from './info-dialog.mod.css'; | ||
|
||
// Like "Spacings.Inline", but with the `justify-content: space-between` style | ||
const Stretched = props => ( |
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.
Any plans on having this in UI Kit at some point? I can verify that we will remove A LOT of custom styles in the MC 🤓 cc/ @montezume
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.
@qmateub you can has an issue create 🐕
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 guess we can also extend the Spacings.Inline
component to support this mode
InfoDialog.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
children: PropTypes.node.isRequired, | ||
horizontalConstraint: PropTypes.oneOf(['m', 'l']), |
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, we only support m
and l
sizes here? Is it a design requirement? I'm saying because I think the original component does not have any of that right? 🤔
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, it's a design requirement
|
||
fireEvent.click(getByLabelText(/Close dialog/)); | ||
await wait(() => { | ||
expect(queryByText(/Lorem ipsus/)).not.toBeInTheDocument(); |
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! I didn't know that you can await and do an expect
😅 . I will keep this in mind for future test writes 👍
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.
Yeah, this comes quite in handy
import InfoDialog from './info-dialog'; | ||
|
||
const DialogController = props => { | ||
const [isOpen, toggle] = React.useState(false); |
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.
Our first hook component 🥺
25b33ec
to
00049d3
Compare
011e07d
to
9aedef9
Compare
FYI: I'll probably wait for a couple of fixes in ui-kit before merging this |
…n clicking on the overlay
0eb792d
to
f32929e
Compare
Based on #366
Refs #323