mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
with emotion example - hoist styles out of the index page component (#3821)
This commit is contained in:
parent
7a1d9c18a3
commit
523b61569b
|
@ -7,66 +7,66 @@ if (typeof window !== 'undefined') {
|
|||
hydrate(window.__NEXT_DATA__.ids)
|
||||
}
|
||||
|
||||
injectGlobal`
|
||||
html, body {
|
||||
padding: 3rem 1rem;
|
||||
margin: 0;
|
||||
background: papayawhip;
|
||||
min-height: 100%;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 24px;
|
||||
}
|
||||
`
|
||||
|
||||
const basicStyles = css`
|
||||
background-color: white;
|
||||
color: cornflowerblue;
|
||||
border: 1px solid lightgreen;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
box-shadow: 5px 5px 0 0 lightgreen, 10px 10px 0 0 lightyellow;
|
||||
transition: all 0.1s linear;
|
||||
margin: 3rem 0;
|
||||
padding: 1rem 0.5rem;
|
||||
`
|
||||
const hoverStyles = css`
|
||||
&:hover {
|
||||
color: white;
|
||||
background-color: lightgray;
|
||||
border-color: aqua;
|
||||
box-shadow: -15px -15px 0 0 aqua, -30px -30px 0 0 cornflowerblue;
|
||||
}
|
||||
`
|
||||
const bounce = keyframes`
|
||||
from {
|
||||
transform: scale(1.01);
|
||||
}
|
||||
to {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
`
|
||||
|
||||
const Basic = styled.div`
|
||||
${basicStyles};
|
||||
`
|
||||
|
||||
const Combined = styled.div`
|
||||
${basicStyles};
|
||||
${hoverStyles};
|
||||
& code {
|
||||
background-color: linen;
|
||||
}
|
||||
`
|
||||
const Animated = styled.div`
|
||||
${basicStyles};
|
||||
${hoverStyles};
|
||||
& code {
|
||||
background-color: linen;
|
||||
}
|
||||
animation: ${props => props.animation} 0.2s infinite ease-in-out alternate;
|
||||
`
|
||||
|
||||
export default () => {
|
||||
injectGlobal`
|
||||
html, body {
|
||||
padding: 3rem 1rem;
|
||||
margin: 0;
|
||||
background: papayawhip;
|
||||
min-height: 100%;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 24px;
|
||||
}
|
||||
`
|
||||
|
||||
const basicStyles = css`
|
||||
background-color: white;
|
||||
color: cornflowerblue;
|
||||
border: 1px solid lightgreen;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
box-shadow: 5px 5px 0 0 lightgreen, 10px 10px 0 0 lightyellow;
|
||||
transition: all 0.1s linear;
|
||||
margin: 3rem 0;
|
||||
padding: 1rem 0.5rem;
|
||||
`
|
||||
const hoverStyles = css`
|
||||
&:hover {
|
||||
color: white;
|
||||
background-color: lightgray;
|
||||
border-color: aqua;
|
||||
box-shadow: -15px -15px 0 0 aqua, -30px -30px 0 0 cornflowerblue;
|
||||
}
|
||||
`
|
||||
const bounce = keyframes`
|
||||
from {
|
||||
transform: scale(1.01);
|
||||
}
|
||||
to {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
`
|
||||
|
||||
const Basic = styled.div`
|
||||
${basicStyles};
|
||||
`
|
||||
|
||||
const Combined = styled.div`
|
||||
${basicStyles};
|
||||
${hoverStyles};
|
||||
& code {
|
||||
background-color: linen;
|
||||
}
|
||||
`
|
||||
const Animated = styled.div`
|
||||
${basicStyles};
|
||||
${hoverStyles};
|
||||
& code {
|
||||
background-color: linen;
|
||||
}
|
||||
animation: ${props => props.animation} 0.2s infinite ease-in-out alternate;
|
||||
`
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Basic>Cool Styles</Basic>
|
||||
|
|
Loading…
Reference in a new issue