File tree Expand file tree Collapse file tree 4 files changed +57
-9
lines changed
Expand file tree Collapse file tree 4 files changed +57
-9
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,25 @@ <h2>Gradient Border Generator</h2>
150150 < div class ="modal-main-content " data-modal ="gradient-border ">
151151 < div class ="input ">
152152 < p > Pick Your Colors:</ p >
153- < input type ="color " id ="gradient-border-color1 " />
154- < input type ="color " id ="gradient-border-color2 " />
153+
154+ < label for ="colorPicker ">
155+ < input
156+ type ="color "
157+ value ="#1DB8CE "
158+ id ="gradient-border-color1 "
159+ />
160+ < span > First Color</ span >
161+ </ label >
162+
163+ < label for ="colorPicker ">
164+ < input
165+ type ="color "
166+ value ="#1DB4CE "
167+ id ="gradient-border-color2 "
168+ />
169+ < span > Second Color</ span >
170+ </ label >
171+
155172 < div class ="btn " data-button ="gradient-border "> Get Result</ div >
156173 </ div >
157174 < div class ="download-output ">
Original file line number Diff line number Diff line change @@ -42,6 +42,16 @@ export function copyCodeToClipboard(
4242 ` ;
4343
4444 break ;
45+ case 'gradient-border' :
46+ const element = outputElement . style ;
47+ codeToCopy = `
48+ div {
49+ border: ${ element . border } ,
50+ border-width: ${ element . borderWidth } ,
51+ border-image-slice: ${ element . borderImageSlice } ,
52+ border-image-source: ${ element . borderImageSource } ,
53+ }
54+ ` ;
4555 }
4656 copy ( codeToCopy ) ;
4757 }
@@ -121,7 +131,7 @@ export const getColorInput1 = (attribute: string): HTMLInputElement =>
121131
122132export const getColorInput2 = ( attribute : string ) : HTMLInputElement =>
123133 < HTMLInputElement > document . getElementById ( `${ attribute } -color2` ) ;
124-
134+
125135export const getOutput = ( attribute : string ) : HTMLElement =>
126136 < HTMLElement > document . querySelector ( `[data-modal = ${ attribute } ] .output` ) ;
127137
Original file line number Diff line number Diff line change @@ -17,16 +17,22 @@ export function gradientBorderGenerator(): void {
1717 firstColor : color1 . value ,
1818 secondColor : color2 . value ,
1919 } ;
20- getGradientBorderResult ( colors , getOutputElement ) ;
20+ getGradientBorderResult ( attribute , colors , getOutputElement ) ;
2121 } ) ;
2222}
2323
2424function getGradientBorderResult (
25+ attribute : string ,
2526 colors : Colors ,
2627 outputElement : HTMLElement ,
2728) : void {
2829 outputElement . style . border = 'solid' ;
2930 outputElement . style . borderWidth = '5px' ;
3031 outputElement . style . borderImageSlice = '1' ;
3132 outputElement . style . borderImageSource = `linear-gradient(100deg, ${ colors . firstColor } , ${ colors . secondColor } )` ;
33+
34+ const getCodeButtonElement = utils . getCopyCodeButton ( attribute ) ;
35+ getCodeButtonElement . addEventListener ( 'click' , ( ) => {
36+ utils . copyCodeToClipboard ( attribute , outputElement ) ;
37+ } ) ;
3238}
Original file line number Diff line number Diff line change @@ -237,13 +237,28 @@ textarea:focus {
237237[data-modal = 'gradient-border' ] .input p {
238238 margin-bottom : 0.5em ;
239239}
240- [data-modal = 'gradient-border' ] [type = 'color' ]: last-of-type {
241- margin-bottom : 1em ;
240+
241+ [data-modal = 'gradient-border' ] .input label {
242+ background-color : # fff ;
243+ display : flex;
244+ padding : 10px ;
245+ margin-bottom : 5px ;
246+ border-radius : 10px ;
247+ color : black;
242248}
243249
244- [data-modal = 'gradient-border' ] [type = 'color' ] {
245- height : 40px ;
246- width : 100% ;
250+ [type = 'color' ] {
251+ width : 30px ;
252+ height : 30px ;
253+ border : none;
254+ margin-right : 10px ;
255+ }
256+
257+ [type = 'color' ]::-webkit-color-swatch-wrapper {
258+ padding : 0 ;
259+ }
260+
261+ [type = 'color' ]::-webkit-color-swatch {
247262 border : none;
248263}
249264
You can’t perform that action at this time.
0 commit comments