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

Add Storybook for developing application components #366

Merged
merged 4 commits into from
Feb 18, 2019
Merged

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Feb 15, 2019

The setup is similar to the one we have in ui-kit.

screenshot 2019-02-15 at 11 06 08

Additional changes

I cleaned up a bit the current components (PageNotFound, ServicePageResponseLayout) and used a css grid to center the elements in the page.
I also renamed ServicePageResponseLayout to MaintenancePageLayout, as the name was very confusing. However, the ServicePageResponseLayout export is still available but marked as deprecated (so no breaking change necessary).

loaders: [require.resolve('@storybook/addon-storysource/loader')],
enforce: 'pre',
},
...mcWebpackConfig.module.rules,
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 found it easier to use like this as we need things like postcss, svg loaders etc.

import styles from './maintenance-page-layout.mod.css';

const MaintenancePageLayout = props => (
<div className={styles.container}>
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 renders a css grid. We can't use the ui-kit Grid as we need additional styles (e.g. height)

const MaintenancePageLayout = props => (
<div className={styles.container}>
<Constraints.Horizontal constraint="l">
<Spacings.Stack scale="m">
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 now use Constraints and Spacings components 🎉

</div>
<div>
<Text.Headline elementType="h2">{props.title}</Text.Headline>
</div>
Copy link
Member Author

Choose a reason for hiding this comment

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

The wrapping divs are for the margins 😕

Copy link
Contributor

@montezume montezume left a comment

Choose a reason for hiding this comment

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

How about putting the storybook config into packages/application-components?

@montezume
Copy link
Contributor

I'm wondering if it might actually make sense to move application-components to another repo? We could use a percy free plan probably.

@tdeekens
Copy link
Contributor

I'm wondering if it might actually make sense to move application-components to another repo? We could use a percy free plan probably.

My head goes like: no please not more repos 😄

@emmenko
Copy link
Member Author

emmenko commented Feb 15, 2019

We could use a percy free plan probably

What do you mean? 🤔

@qmateub
Copy link
Contributor

qmateub commented Feb 15, 2019

Maybe Malcolm means to have that new repo with VRT (percy) for all the common components like the PageNotFound 🤔

I like a lot the idea of having this Nicola 🥇

@montezume
Copy link
Contributor

I mean if we triggered VRT tests everytime there was a chance in any of the packages, we would be wasting snaps and spending a lot of money, whereas if we had a way of running and requiring VRT when rollup config and or the components themselves changed, that would be more reasonable.

@emmenko
Copy link
Member Author

emmenko commented Feb 15, 2019

We can run percy only if something in the package changed right?

@montezume
Copy link
Contributor

montezume commented Feb 15, 2019

@emmenko yes, but if we enabled percy for the whole github repo, it would block merging of PRs that didn't run Percy.

@tdeekens
Copy link
Contributor

We could have a "global" run script called test:vrts this would run in all packages via lerna. Each package then has a test:vrts which for all, apart one, does exit 0 as they don't have vrts while for one it runs percy. I would suggest this to be another PR though. I don't really like having another repo just to have VRTs to be honest.

@@ -25,6 +25,8 @@
"test:watch": "jest --config jest.test.config.js --watch",
"playground:start": "yarn --cwd playground start",
"playground:build": "yarn --cwd playground build",
"storybook:build": "yarn --cwd packages/application-components storybook:build",
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 these scripts be part of the application-components package?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to use yarn workspace application-components storybook:build here? ref

@montezume
Copy link
Contributor

Yeah, sorry for throwing us off track. Let's concentrate on Storybook in this PR of course

@emmenko
Copy link
Member Author

emmenko commented Feb 15, 2019

I think what Malcom means is the github check for Percy?

@montezume
Copy link
Contributor

@emmenko exactly.

@montezume montezume dismissed their stale review February 15, 2019 12:48

nevermind

@emmenko emmenko mentioned this pull request Feb 15, 2019
import { getDisplayName } from 'recompose';
import warning from 'warning';

export default function({ message = '' }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this here?
Is the intention then to import from app-kit when using deprecate-component in the future?

/>,
{ route: '/my-project' }
);
await waitForElement(() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

no assertion that follows?

Copy link
Contributor

Choose a reason for hiding this comment

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

This would throw already so the test fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦‍♂️

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.

Thanks. I am fine with that and think it's really helpful!

@emmenko emmenko merged commit 09b5a19 into master Feb 18, 2019
@emmenko emmenko deleted the nm-storybook branch February 18, 2019 14:06
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.

5 participants