1- import styled from 'styled-components'
2- import { Card , FormControlLabel as MuiFormControlLabel } from '@material-ui/core'
3- import { darkGrey } from '../../ui/constants'
1+ import styled , { css } from 'styled-components'
42import _get from 'lodash/get'
3+ import {
4+ Card ,
5+ TextareaAutosize ,
6+ FormControlLabel as MuiFormControlLabel
7+ } from '@material-ui/core'
8+ import { darkGrey } from '../../ui/constants'
9+ import { generateSkewCss } from './codeGenerators'
510
611export const Container = styled . main `
712 height: 100vh;
@@ -44,44 +49,50 @@ export const Top = styled(Section)`
4449 color: #fff;
4550 background: ${ darkGrey } ;
4651
47- &.curved {
48- border-bottom-left-radius: 50% ${ props => _get ( props , 'options.curve.value' ) } %;
49- border-bottom-right-radius: 50% ${ props => _get ( props , 'options.curve.value' ) } %;
50-
51- &.reverse {
52- border-bottom-left-radius: 0;
53- border-bottom-right-radius: 0;
54-
55- &::after {
56- content: '';
57- border-top-left-radius: 50% ${ props => 100 - _get ( props , 'options.curve.value' ) || 0 } %; /* TODO fix */
58- border-top-right-radius: 50% ${ props => 100 - _get ( props , 'options.curve.value' ) || 0 } %;
59- position: absolute;
60- bottom: 0;
61- width: 100%;
62- background: #fff;
63- height: 50px;
64- }
65- }
52+ &.skewed {
53+ background: transparent;
6654 }
55+ `
56+
57+ export const Curved = styled ( Top ) `
58+ border-bottom-left-radius: 50% ${ props => _get ( props , 'options.curve.value' ) } %;
59+ border-bottom-right-radius: 50% ${ props => _get ( props , 'options.curve.value' ) } %;
60+
61+ &.reverse {
62+ border-bottom-left-radius: 0;
63+ border-bottom-right-radius: 0;
6764
68- &.spikes {
6965 &::after {
7066 content: '';
67+ border-top-left-radius: 50% ${ props => 100 - _get ( props , 'options.curve.value' ) || 0 } %; /* TODO fix */
68+ border-top-right-radius: 50% ${ props => 100 - _get ( props , 'options.curve.value' ) || 0 } %;
7169 position: absolute;
72- right: 0;
73- left: 0;
74- top: 100%;
75- z-index: 10;
76- display: block;
77- height: ${ props => _get ( props , 'options.size.value' ) } px;
78- background-size: ${ props => _get ( props , 'options.size.value' ) } px 100%;
79- background-image: linear-gradient(135deg, ${ darkGrey } 25%, transparent 25%), linear-gradient(225deg, ${ darkGrey } 25%, transparent 25%);
80- background-position: ${ props => _get ( props , 'options.left.value' ) } %;
70+ bottom: 0;
71+ width: 100%;
72+ background: #fff;
73+ height: 50px;
8174 }
8275 }
76+ `
8377
84- &.triangle::before {
78+ export const Spikes = styled ( Top ) `
79+ &::after {
80+ content: '';
81+ position: absolute;
82+ right: 0;
83+ left: 0;
84+ top: 100%;
85+ z-index: 10;
86+ display: block;
87+ height: ${ props => _get ( props , 'options.size.value' ) } px;
88+ background-size: ${ props => _get ( props , 'options.size.value' ) } px 100%;
89+ background-image: linear-gradient(135deg, ${ darkGrey } 25%, transparent 25%), linear-gradient(225deg, ${ darkGrey } 25%, transparent 25%);
90+ background-position: ${ props => _get ( props , 'options.left.value' ) } %;
91+ }
92+ `
93+
94+ export const Triangle = styled ( Top ) `
95+ &::before {
8596 content: '';
8697 position: absolute;
8798 bottom: 0;
@@ -92,15 +103,17 @@ export const Top = styled(Section)`
92103 height: ${ props => _get ( props , 'options.size.value' ) } px;
93104 transform:
94105 translateX(-50%)
95- translateY(${ props => _get ( props , 'options.top.value' ) } %)
106+ translateY(50 %)
96107 rotate(45deg);
97108 }
98109
99- &.triangle. reverse::before {
110+ &.reverse::before {
100111 background: #fff;
101112 }
113+ `
102114
103- &.semiCircle::before {
115+ export const SemiCircle = styled ( Top ) `
116+ &::before {
104117 position: absolute;
105118 content: '';
106119 left: ${ props => _get ( props , 'options.left.value' ) } %;
@@ -113,32 +126,16 @@ export const Top = styled(Section)`
113126 bottom: 0px;
114127 }
115128
116- &.semiCircle. reverse::before {
129+ &.reverse::before {
117130 background: #fff;
118- }
119-
120- &.skewed {
121- background: transparent;
131+ transform:
132+ translateX(-50%)
133+ translateY(${ props => ( _get ( props , 'options.top.value' ) || 0 ) * - 1 + 100 } %);
122134 }
123135`
124136
125137export const SkewBg = styled . div `
126- position: absolute;
127- top: 0;
128- bottom: 0;
129- right: 0;
130- left: 0;
131- width: 100%;
132- height: 100%;
133- background: ${ darkGrey } ;
134- transform: ${ props => `skewY(${ props . angle } deg)` } ;
135- transform-origin: top right;
136- z-index: 0;
137-
138- &.reverse {
139- transform: ${ props => `skewY(-${ props . angle } deg)` } ;
140- transform-origin: top left;
141- }
138+ ${ props => generateSkewCss ( props . options ) }
142139`
143140
144141export const Wave = styled . div `
@@ -217,18 +214,35 @@ export const Row = styled.div`
217214
218215export const Controls = styled ( Card ) `
219216 position: relative;
220- background-color: #fff ;
217+ background-color: rgba(255,255,255,0.7) !important ;
221218 z-index: 20;
222219
223- @media (max-height: 768px ) { /* TODO figure out height */
220+ @media (max-height: 900px ) {
224221 position: absolute;
225- background-color: rgba(255,255,255,0.7) !important;
226222 top: 100px;
227223 }
228224`
229225
230226export const ControlContent = styled . div `
231227 padding: 10px;
228+ display: ${ props => props . isVisible ? 'block' : 'none' } ;
229+ `
230+
231+ export const ControlToggle = styled . div `
232+ @media (min-height: 899px) {
233+ display: none;
234+ }
235+
236+ padding: 10px;
237+ border-top: 1px solid rgba(0,0,0,0.23);
238+ cursor: pointer;
239+
240+ > span {
241+ color: rgba(0, 0, 0, 0.54);
242+ display: flex;
243+ align-items: center;
244+ justify-content: center;
245+ }
232246`
233247
234248export const FormControlLabel = styled ( MuiFormControlLabel ) `
@@ -240,4 +254,23 @@ export const SliderContainer = styled.div`
240254 text-transform: capitalize;
241255 color: ${ darkGrey } ;
242256 }
257+ `
258+ export const CodeArea = styled ( TextareaAutosize ) `
259+ width: 100%;
260+ margin-bottom: ${ props => props . marginBottom ? '20px' : '0' } ;
261+ `
262+
263+ export const Copied = styled . span `
264+ display: inline-block;
265+ padding: 4px;
266+ margin-right: 5px;
267+ background: rgba(0,0,0,0.8);
268+ color: rgba(255,255,255,0.6);
269+ border-radius: 5px;
270+ opacity: 0;
271+ transition: opacity 0.3s;
272+
273+ ${ props => props . visible && css `
274+ opacity: 1;
275+ ` }
243276`
0 commit comments