2017-06-29 05:44:48 +00:00
|
|
|
import React from 'react'
|
2018-10-15 15:02:19 +00:00
|
|
|
import Head from 'next/head'
|
2018-11-29 19:12:25 +00:00
|
|
|
import styled from '@emotion/styled'
|
|
|
|
import { keyframes, css, Global } from '@emotion/core'
|
2017-06-29 05:44:48 +00:00
|
|
|
|
2018-02-16 07:48:21 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
`
|
2017-06-29 05:44:48 +00:00
|
|
|
|
2018-02-16 07:48:21 +00:00
|
|
|
const Basic = styled.div`
|
|
|
|
${basicStyles};
|
|
|
|
`
|
2017-10-09 21:18:37 +00:00
|
|
|
|
2018-02-16 07:48:21 +00:00
|
|
|
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;
|
|
|
|
`
|
2017-06-29 05:44:48 +00:00
|
|
|
|
2018-02-16 07:48:21 +00:00
|
|
|
export default () => {
|
2017-06-29 05:44:48 +00:00
|
|
|
return (
|
2018-12-04 11:48:15 +00:00
|
|
|
<React.Fragment>
|
2018-12-04 10:55:33 +00:00
|
|
|
<Global
|
|
|
|
styles={css`
|
|
|
|
html,
|
|
|
|
body {
|
|
|
|
padding: 3rem 1rem;
|
|
|
|
margin: 0;
|
|
|
|
background: papayawhip;
|
|
|
|
min-height: 100%;
|
|
|
|
font-family: Helvetica, Arial, sans-serif;
|
|
|
|
font-size: 24px;
|
2018-11-29 19:12:25 +00:00
|
|
|
}
|
|
|
|
`}
|
2018-12-04 10:55:33 +00:00
|
|
|
/>
|
|
|
|
<Head>
|
|
|
|
<title>With Emotion</title>
|
|
|
|
</Head>
|
|
|
|
<div>
|
|
|
|
<Basic>Cool Styles</Basic>
|
|
|
|
<Combined>
|
2018-10-15 15:02:19 +00:00
|
|
|
With <code>:hover</code>.
|
2018-12-04 10:55:33 +00:00
|
|
|
</Combined>
|
|
|
|
<Animated animation={bounce}>Let's bounce.</Animated>
|
|
|
|
</div>
|
2018-12-04 11:48:15 +00:00
|
|
|
</React.Fragment>
|
2017-06-29 05:44:48 +00:00
|
|
|
)
|
|
|
|
}
|