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

feat: add <InfoDialog> #367

Merged
merged 13 commits into from
Feb 20, 2019
Merged

feat: add <InfoDialog> #367

merged 13 commits into from
Feb 20, 2019

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Feb 15, 2019

Based on #366

Refs #323

2019-02-15 17 25 18

@emmenko emmenko added 🙏 Status: Dev Review Waiting for technical reviews 🚀 Type: New Feature Something new labels Feb 15, 2019
@emmenko emmenko requested a review from montezume February 15, 2019 16:49
import InfoDialog from './info-dialog';

const DialogController = props => {
const [isOpen, toggle] = React.useState(false);
Copy link
Contributor

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) 😄

Copy link
Member Author

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.

Copy link
Contributor

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 😁

Copy link
Contributor

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%',
}}
Copy link
Contributor

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".

Copy link
Member Author

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.

Copy link
Contributor

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.

@tdeekens
Copy link
Contributor

@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?

@emmenko emmenko requested a review from aminbenselim February 15, 2019 17:05
{props.title}
</Text.Subheadline>
<SecondaryIconButton
label="Close dialog"
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

justifyContent: 'center',
height: '100%',
width: '100%',
}}
Copy link
Contributor

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';
Copy link
Contributor

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 💯

Copy link
Contributor

@tdeekens tdeekens left a 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,
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 make this a node? This would require anybody to use formatMessage and apply the HoC over just rendering a <FormattedMessage />?

Copy link
Member Author

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).

Copy link
Contributor

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.

Copy link
Contributor

@qmateub qmateub left a 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 :shipit: 👌

import styles from './info-dialog.mod.css';

// Like "Spacings.Inline", but with the `justify-content: space-between` style
const Stretched = props => (
Copy link
Contributor

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

Copy link
Contributor

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 🐕

Copy link
Member Author

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']),
Copy link
Contributor

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? 🤔

Copy link
Member Author

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();
Copy link
Contributor

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 👍

Copy link
Member Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Our first hook component 🥺

@emmenko
Copy link
Member Author

emmenko commented Feb 19, 2019

FYI: I'll probably wait for a couple of fixes in ui-kit before merging this

@emmenko emmenko merged commit ba359a3 into master Feb 20, 2019
@emmenko emmenko deleted the nm-info-dialog branch February 20, 2019 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 Status: Dev Review Waiting for technical reviews 🚀 Type: New Feature Something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants