-
Notifications
You must be signed in to change notification settings - Fork 712
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
Load contrast stylesheet #2256
Load contrast stylesheet #2256
Conversation
b55ff7f
to
f16fa1d
Compare
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.
Are you sure you pushed all the commits?
Asking because webpack.local.config.js
is not rebased right and isContrastMode
helper is still being called across files.
4f4fb81
to
fe87d72
Compare
@fbarl Sorry about the false-start. This should be ready for you review now. Things I tested:
|
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.
Good job! There is quite a bit of webpack magic going on, but all the scenarios you mentioned also worked well on my machine. :)
Some of the comments I left may need to be addressed before you merge, but the changes should be rather straightforward.
@@ -664,6 +677,10 @@ export function route(urlState) { | |||
state.get('nodeDetails'), | |||
dispatch | |||
); | |||
|
|||
if (urlState.contrastMode) { | |||
dispatch(toggleContrastMode(true)); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
// Append a script to the end of <head /> to evaluate before the other scripts are loaded. | ||
const script = `<script>window.__WEAVE_SCOPE_THEMES = JSON.parse('${themes}')</script>`; | ||
const [head, end] = htmlPluginData.html.split('</head>'); | ||
htmlPluginData.html = head.concat(script).concat(end); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
link.rel = 'stylesheet'; | ||
link.href = `${window.__WEAVE_SCOPE_THEMES.publicPath}${stylesheet}`; | ||
|
||
head.appendChild(link); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
filename: 'contrast.html' | ||
}), | ||
new HtmlWebpackPlugin({ | ||
hash: true, | ||
chunks: ['vendors', 'terminal-app'], |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Also, sorry for the conflicts with master, they're due to my layout optimizations PR. Just double check for |
026e520
to
4df3f7f
Compare
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.
LGTM! Works like charm :)
Just before you merge, maybe you'd want to squash your last two commits into one?
4df3f7f
to
f2f474a
Compare
Part of https://github.com/weaveworks/service-ui/pull/184
Instead of loading a separate contrast.html page when the user clicks the contrast button, load a different stylesheet that will override the normal scope styles.
A window level variable is written to the index.html file. Adds a webpack plugin to accomplish this. From the code:
@fbarl New approach to the previous PR. PTAL