Skip to content
Snippets Groups Projects
Commit 04e9061d authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

feat(pubsweet-client): upgrade styled-components

BREAKING CHANGE: Replace styled-components injectGlobal with new createGlobalStyle
parent 129ba14a
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
"redux-logger": "^3.0.1", "redux-logger": "^3.0.1",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"styled-components": "^3.2.5", "styled-components": "^4.1.1",
"styled-normalize": "^3.0.1", "styled-normalize": "^3.0.1",
"subscriptions-transport-ws": "^0.9.12" "subscriptions-transport-ws": "^0.9.12"
}, },
......
...@@ -12,9 +12,8 @@ import { getMainDefinition } from 'apollo-utilities' ...@@ -12,9 +12,8 @@ import { getMainDefinition } from 'apollo-utilities'
import { setContext } from 'apollo-link-context' import { setContext } from 'apollo-link-context'
import { InMemoryCache } from 'apollo-cache-inmemory' import { InMemoryCache } from 'apollo-cache-inmemory'
import { createUploadLink } from 'apollo-upload-client' import { createUploadLink } from 'apollo-upload-client'
import StyleRoot, { injectGlobalStyles } from '../helpers/StyleRoot' import { Normalize } from 'styled-normalize'
import StyleRoot from '../helpers/StyleRoot'
injectGlobalStyles()
// Construct an ApolloClient. If a function is passed as the first argument, // Construct an ApolloClient. If a function is passed as the first argument,
// it will be called with the default client config as an argument, and should // it will be called with the default client config as an argument, and should
...@@ -71,6 +70,7 @@ const Root = ({ ...@@ -71,6 +70,7 @@ const Root = ({
<Provider store={store}> <Provider store={store}>
<ConnectedRouter history={history}> <ConnectedRouter history={history}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Normalize />
<StyleRoot>{routes}</StyleRoot> <StyleRoot>{routes}</StyleRoot>
</ThemeProvider> </ThemeProvider>
</ConnectedRouter> </ConnectedRouter>
......
import styled, { injectGlobal } from 'styled-components' import styled from 'styled-components'
import styledNormalize from 'styled-normalize'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
const injectGlobalStyles = () => injectGlobal`
${styledNormalize}
`
const StyleRoot = styled.div` const StyleRoot = styled.div`
background-color: ${th('colorBackground')}; background-color: ${th('colorBackground')};
font-family: ${th('fontInterface')}, sans-serif; font-family: ${th('fontInterface')}, sans-serif;
...@@ -19,4 +14,3 @@ const StyleRoot = styled.div` ...@@ -19,4 +14,3 @@ const StyleRoot = styled.div`
` `
export default StyleRoot export default StyleRoot
export { injectGlobalStyles }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment