@@ -33,8 +33,43 @@ import { FiCopy } from 'react-icons/fi';
3333// misc utilities
3434import { getShapeId } from "../../utils/misc" ;
3535
36- const CSSDisplay = styled . span `
36+ const CSSDisplayContainer = styled . div `
37+ position: relative;
38+ background-color: var(--color-neutral-80);
39+ padding: 0 0 2rem 0;
40+ height: 240px;
41+ overflow: hidden;
42+ ` ;
43+
44+ const CSSDisplay = styled . pre `
3745 white-space: pre-line;
46+ color: #f5d67b;
47+ max-height: 180px;
48+ overflow: auto;
49+ margin: 1rem 0.4rem 1rem 1rem;
50+ padding-right: 0.4rem;
51+ ` ;
52+
53+ const CopyButton = styled ( Button ) `
54+ position: absolute;
55+ display: flex !important;
56+ align-items: center;
57+ justify-content: center;
58+ grid-gap: 0.4rem;
59+ color: var(--color-neutral-10) !important;
60+ left: 0.4rem;
61+ bottom: 0.4rem;
62+ width: calc(100% - 0.8rem);
63+ padding: 0.3rem 0.6rem !important;
64+ font-size: var(--fs-sm) !important;
65+ background-color: var(--color-brand) !important;
66+ cursor: pointer;
67+
68+ &:hover,
69+ &:focus {
70+ background-color: var(--color-brand-light) !important;
71+ text-decoration: none !important;
72+ }
3873` ;
3974
4075const CopyIcon = styled ( FiCopy ) `
@@ -97,17 +132,29 @@ const CopyShapeSource = ({ show, setShow, shape }) => {
97132 < Modal . Body >
98133 < Container fluid >
99134 < Row >
135+ < Col >
136+ < ShapeContainer >
137+ < Shape
138+ name = { shape . name }
139+ formula = { shape . formula }
140+ width = "300px"
141+ height = "300px"
142+ backgroundColor = { shape . backgroundColor }
143+ id = { getShapeId ( shape . name , true ) }
144+ />
145+ </ ShapeContainer >
146+ </ Col >
100147 < Col >
101148 < Form >
102149 < div >
103150 < Form . Group >
104151 < Form . Label > Export As</ Form . Label >
105152 < div >
106- < ToggleButtonGroup type = "radio" name = "options" defaultValue = { 1 } variant = "outline-dark " size = "sm" defaultValue = { type } >
107- < ToggleButton id = "tbg-radio-1" value = { 'css' } variant = "outline-dark " onClick = { ( ) => setType ( 'css' ) } >
153+ < ToggleButtonGroup type = "radio" name = "options" defaultValue = { 1 } variant = "outline-info " size = "sm" defaultValue = { type } >
154+ < ToggleButton id = "tbg-radio-1" value = { 'css' } variant = "outline-info " onClick = { ( ) => setType ( 'css' ) } >
108155 Show CSS
109156 </ ToggleButton >
110- < ToggleButton id = "tbg-radio-2" value = { 'clip-path' } variant = "outline-dark " onClick = { ( ) => setType ( 'clip-path' ) } >
157+ < ToggleButton id = "tbg-radio-2" value = { 'clip-path' } variant = "outline-info " onClick = { ( ) => setType ( 'clip-path' ) } >
111158 Show Clip-Path
112159 </ ToggleButton >
113160 </ ToggleButtonGroup >
@@ -125,44 +172,48 @@ const CopyShapeSource = ({ show, setShow, shape }) => {
125172 < div >
126173 { type === 'css' &&
127174 < >
175+ < hr />
128176 < h3 > CSS Snippet</ h3 >
129- < CSSDisplay >
130- < code > { getCSS ( shape . formula ) } </ code >
131- </ CSSDisplay >
132- < CopyIcon size = { 20 } onClick = { ( ) => copy ( shape . formula , true ) } />
177+ < CSSDisplayContainer >
178+ < CSSDisplay rel = 'css' >
179+ < code > { getCSS ( shape . formula ) } </ code >
180+ </ CSSDisplay >
181+ < CopyButton onClick = { ( ) => copy ( shape . formula , true ) } variant = "link" className = "btn-icon" >
182+ < CopyIcon color = 'var(--color-neutral-10' size = "16px" />
183+ < div > Copy to Clipboard</ div >
184+ </ CopyButton >
185+ </ CSSDisplayContainer >
133186 </ >
134187 }
135188 { type === 'clip-path' &&
136189 < div >
190+ < hr />
137191 < h3 > Clip-Path Value</ h3 >
138- < code > { shape . formula } </ code >
139- < CopyIcon size = { 20 } onClick = { ( ) => copy ( shape . formula , false ) } />
192+ < CSSDisplayContainer >
193+ < CSSDisplay rel = 'css' >
194+ < code > { shape . formula } </ code >
195+ </ CSSDisplay >
196+ < CopyButton onClick = { ( ) => copy ( shape . formula , false ) } variant = "link" className = "btn-icon" >
197+ < CopyIcon color = 'var(--color-neutral-10' size = "16px" />
198+ < div > Copy to Clipboard</ div >
199+ </ CopyButton >
200+ </ CSSDisplayContainer >
140201 </ div >
202+
141203 }
142204 </ div >
143205 )
144206 }
145207 </ Form >
146208 </ Col >
147- < Col >
148- < ShapeContainer >
149- < Shape
150- name = { shape . name }
151- formula = { shape . formula }
152- width = "300px"
153- height = "300px"
154- backgroundColor = { shape . backgroundColor }
155- id = { getShapeId ( shape . name , true ) }
156- />
157- </ ShapeContainer >
158- </ Col >
209+
159210 </ Row >
160211 </ Container >
161212 </ Modal . Body >
162213
163214 < Modal . Footer >
164215 < Button variant = "outline-info" onClick = { ( ) => setShow ( false ) } >
165- Cancel
216+ Close
166217 </ Button >
167218 </ Modal . Footer >
168219 </ Modal >
0 commit comments