-
Notifications
You must be signed in to change notification settings - Fork 350
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
[Storybook] Update styles to be more accurate to prod #1945
Changes from 4 commits
d5abc66
d498113
281b86c
1d9edc2
0029d19
dd756f0
30970dd
8766cc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* This file contains styles that are used in prod that ultimately | ||
* get passed onto Perseus components. This file is imported in the | ||
* .storybook/preview.js file so that the components can have the same | ||
* styles as prod when viewed within Storybook. | ||
*/ | ||
|
||
// Variables | ||
@offBlack: #21242c; | ||
@wonderBlocksFontFamily: "Lato", "Noto Sans", "Helvetica", "Corbel", sans-serif; | ||
|
||
// Layers | ||
@layer reset, shared; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs to include
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true, but I left it out since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please add it. Although That said, since this is the first time that we have declared and used layers in Perseus, we should verify how this comes across in PROD. Perhaps a ZND would help? I want to make sure that we aren't making sub-layers due to how these styles are imported. |
||
|
||
@layer reset { | ||
// A CSS reset. Needed for every page. | ||
@import (inline) "./reset.css"; | ||
} | ||
|
||
@layer shared { | ||
html, | ||
body { | ||
height: 100%; | ||
} | ||
|
||
body { | ||
font-family: @wonderBlocksFontFamily, "Helvetica", "Corbel", sans-serif; | ||
font-size: 14px; | ||
margin: 0; | ||
color: @offBlack; | ||
line-height: 1.4; | ||
min-width: 0 !important; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this really need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that was already there in webapp with the comment
But I don't think that's relevant anymore? I don't see a |
||
} | ||
|
||
.box-sizing-border-box-reset { | ||
box-sizing: border-box; | ||
} | ||
|
||
.box-sizing-border-box-reset * { | ||
box-sizing: inherit; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* http://meyerweb.com/eric/tools/css/reset/ | ||
v2.0 | 20110126 | ||
License: none (public domain) | ||
*/ | ||
|
||
html, | ||
body, | ||
div, | ||
span, | ||
applet, | ||
object, | ||
iframe, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
p, | ||
blockquote, | ||
pre, | ||
a, | ||
abbr, | ||
acronym, | ||
address, | ||
big, | ||
cite, | ||
code, | ||
del, | ||
dfn, | ||
em, | ||
img, | ||
ins, | ||
kbd, | ||
q, | ||
s, | ||
samp, | ||
small, | ||
strike, | ||
strong, | ||
sub, | ||
sup, | ||
tt, | ||
var, | ||
b, | ||
u, | ||
i, | ||
center, | ||
dl, | ||
dt, | ||
dd, | ||
ol, | ||
ul, | ||
li, | ||
fieldset, | ||
form, | ||
label, | ||
legend, | ||
table, | ||
caption, | ||
tbody, | ||
tfoot, | ||
thead, | ||
tr, | ||
th, | ||
td, | ||
article, | ||
aside, | ||
canvas, | ||
details, | ||
embed, | ||
figure, | ||
figcaption, | ||
footer, | ||
header, | ||
hgroup, | ||
menu, | ||
nav, | ||
output, | ||
ruby, | ||
section, | ||
summary, | ||
time, | ||
mark, | ||
audio, | ||
video { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, | ||
aside, | ||
details, | ||
figcaption, | ||
figure, | ||
footer, | ||
header, | ||
hgroup, | ||
menu, | ||
nav, | ||
section { | ||
display: block; | ||
} | ||
body { | ||
line-height: 1; | ||
} | ||
ol, | ||
ul { | ||
list-style: none; | ||
} | ||
blockquote, | ||
q { | ||
quotes: none; | ||
} | ||
blockquote:before, | ||
blockquote:after, | ||
q:before, | ||
q:after { | ||
content: ""; | ||
content: none; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
|
||
/* End Reset */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as React from "react"; | ||
|
||
import "./global.less"; | ||
|
||
/** | ||
* Wrapper for Storybook stories that | ||
* 1. Renders the story inside of a .framework-perseus container | ||
* 2. Includes the global styles from prod | ||
*/ | ||
function StoryWrapper(props) { | ||
// Most of our components have an expectation to be | ||
// rendered inside of a .framework-perseus container. | ||
// We want to make sure we can include it here, since it | ||
// can also affect the styling. | ||
return ( | ||
<div className="framework-perseus box-sizing-border-box-reset"> | ||
{props.children} | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a separate file for this? Could we not just wrap the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah. Now that I removed the import, I'll change it back to how it was before. |
||
); | ||
} | ||
|
||
export default StoryWrapper; |
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 think this is a great place to put this. Then you can include it in
perseus-renderer.less
. That file is imported inrenderer.tsx
(which is our core renderer the all articles and exercises use). That should guarantee that these global styles are always included.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.
@jeremywiebe but maybe not in the
.storybook
folder, right? I can move it whereperseus-renderer.less
is?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.
Correct. This will become a part of our production Perseus CSS so it should go alongside the
perseus-renderer.less
file.