Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Jb/update storybook theme #246

Merged
merged 9 commits into from
Mar 23, 2020
Merged

Jb/update storybook theme #246

merged 9 commits into from
Mar 23, 2020

Conversation

jbouzi12
Copy link
Contributor

This PR is the first step to customizing and updating the storybook config. I initially planned to include the configuration updates but with shifting priorities I wanted to at least get the theme updates out there so the branch doesn't get stale.

Future updates

  • update prettier configuration to properly lint mdx
  • update storybook configuration to fix emotion styled component parsing errors

@@ -0,0 +1,12 @@
<style>
Copy link
Collaborator

Choose a reason for hiding this comment

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

What area of the storybook do these styles apply to?

<style>
body {
font-family: 'Fira Mono', monospace;
color: '#fff';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the storybook html/body styles should match what we have in layout.js

This color isn't working because of the quotes.

}
.sbdocs-p code,
.sbdocs-li code {
color: #fff !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we use pure white anywhere on the site. The only exception I see is in link.js where I think I had a placeholder color that never got updated. I see a bunch of #fff in the SB theme, but that doesn't reflect the color we use.


// Text colors
textColor: '#fff',
textInverseColor: colorMap.devWhite,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does this work? These two values are both white, what makes one 'inverse'? I think we should avoid #fff if possible since it's not part of the theme.

@@ -0,0 +1,12 @@
<style>
body {
font-family: 'Fira Mono', monospace;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is part of the preview area shouldn't it be populated from theme file configs?

appBorderRadius: 4,

// Typography
fontBase: `akzidenz, -apple-system, BlinkMacSystemFont, "Segoe UI",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think akzidenz or fira font files are being loaded.

@@ -42,8 +43,9 @@ import { colorMap, gradientMap, size, fontSize } from '../theme';
<Story name="gradients">
{() => {
const Wrapper = styled('div')`
fontfamily: 'Fira Mono', monospace;
fontsize: ${fontSize.xsmall};
color: #fff;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments as above, but I'm curious why we need to define these styles in multiple places. Shouldn't the theme be global for storybook?

@jbouzi12
Copy link
Contributor Author

@greggb Due to the issues with mdx not fully rendering emotion styled components properly (this item is a TODO for the storybook setup), certain styles aren't being rendered properly. For example text colors in some components and the font-family of some components aren't rendering properly.

The .storybook/theme.js styles the majority of the storybook theme, but certain defaults (particularly the font styles) aren't getting to the styled components. For this reason I temporarily added font-styles to some stories themselves so they can at least be more visually correct in the mean time.

Also, I mainly used the styles in preview-head.html to style storybook's default inline code-blocs and also attempt to apply the font-color and font-family globally through the body tag. But since these two styles still aren't hitting the styled components I'll take these body styles out.

@greggb
Copy link
Collaborator

greggb commented Mar 19, 2020

I found a couple issues around that - do either of these help?
storybookjs/storybook#9602
storybookjs/storybook#7325

@jbouzi12
Copy link
Contributor Author

Yea I found these before going back to the cert editor page work as they seemed promising. I have a separate branch where I started implementing some of these suggestions.

Copy link
Collaborator

@greggb greggb left a comment

Choose a reason for hiding this comment

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

Ideally we'd move all the #fff to devWhite, but if this needs to just get in to move on that's ok

@jbouzi12
Copy link
Contributor Author

Thanks!

@jbouzi12 jbouzi12 merged commit 343fee2 into staging Mar 23, 2020
@jbouzi12 jbouzi12 deleted the jb/update-storybook-theme branch March 23, 2020 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants