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 some basic styling for the form #109

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

muffinresearch
Copy link
Contributor

Fixes mozilla/addons#5643

This is just the beginning of the CSS:

  • I've turned off the identifier munging so that we don't need to use className={style.whatever} and can instead just use regular className="whatever". This makes sharing styles easier plus there's some weird limitations with loaded classnames as far as referencing the container etc.
  • Normalize.css is included to reset styles. Other than that this is just our own styles it should be really simple so adding bootstrap isn't needed.

Mobile:
isomorphic_redux_demo

Desktop:

isomorphic_redux_demo

@@ -58,7 +58,7 @@ export default Object.assign({}, webpackConfig, {
query: BABEL_QUERY,
}, {
test: /\.scss$/,
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap',
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this removing a hash fingerprint from the filename?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep - I removed the local identifier stuff so that it just uses normal classnames. I don't really like the {style.blah}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just noticed sometimes the css isn't loaded on a fresh start-up. I'll look into that...

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 thought this was for file name not class name. That's cool.

box-sizing: border-box !important;
flex-grow: 1;
font-size: $font-size-l;
height: 3rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using em and rem sounds like a good idea but every time I look at something describing how to use them it feels way too complicated. MDN linked to Compose to a Vertical Rhythm and putting that math in feels like it could be error prone to me.

I feel like we should have some mixins for setting font size while maintaining line-height, etc. If that were the case I don't think we'd need to set an explicit height here (but I could quite definitely be wrong, I've never used em/rem).

@mstriemer
Copy link
Contributor

I commented on the rem/em thing but it got marked resolved immediately.

The first time I ran the server I got this error but restarting the server fixed it:

[1] [webpack-isomorphic-tools] [error] asset not found: ./search/css/lib/buttons.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./search/css/SearchResults.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./search/css/SearchPage.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./search/css/App.scss

I get a flash of unstyled content when I load the page, is that what you're looking at?

This is what I see for some reason:

screenshot 2016-03-10 13 31 35

@muffinresearch
Copy link
Contributor Author

Yeah that !important or higher specificity was needed. I'm fixing now.

@muffinresearch
Copy link
Contributor Author

Looks like turning off css-modules support entirely fixes the problem I was having. Just going to test again and then I'll push the changes.

@muffinresearch
Copy link
Contributor Author

@mstriemer that's working better now. I don't get the unstyled content on startup any more.

@@ -57,7 +57,7 @@ export default function(routes) {
app.use(Express.static(path.join(__dirname, '../../../dist')));

// Return 204 for csp reports.
app.post('/__cspreport__', (req, res) => res.status(204));
app.post('/__cspreport__', (req, res) => res.status(200).end('ok'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this because I noticed FF seemed to be spinning it's wheels a bit when CSP reports were kicking off. I'm going to leave this since 200 OK won't hurt.

@mstriemer
Copy link
Contributor

Still getting a flash but it's more like a flicker than the full second it was before so that's fine.

@muffinresearch
Copy link
Contributor Author

Still getting a flash but it's more like a flicker than the full second it was before so that's fine.

Yep that's expected.

height: 3rem;
margin: 0;
max-width: 640px;
padding: 0.15em 0.25em 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

The vertical padding here doesn't seem to affect the spacing.

@mstriemer
Copy link
Contributor

Looks good, r+wc

muffinresearch added a commit that referenced this pull request Mar 10, 2016
Add some basic styling for the form
@muffinresearch muffinresearch merged commit ccaf19f into mozilla:master Mar 10, 2016
@muffinresearch muffinresearch deleted the add-styles branch March 10, 2016 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants