File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -639,7 +639,11 @@ <h2>
639
639
640
640
< div class ="btn-container ">
641
641
< div class ="reset " data-reset ="gradient-background "> Reset</ div >
642
- < div class ="btn " data-button ="gradient-background ">
642
+ < div
643
+ class ="btn "
644
+ data-button ="gradient-background "
645
+ id ="getResultBtn "
646
+ >
643
647
Get Result
644
648
</ div >
645
649
</ div >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
getCssOrTailwindButton ,
15
15
} from '../lib/getElements' ;
16
16
import {
17
+ triggerEmptyAnimation ,
17
18
copyCSSCodeToClipboard ,
18
19
showPopup ,
19
20
whatColorButtonShouldShow ,
@@ -34,7 +35,7 @@ const attribute = 'gradient-background';
34
35
35
36
const getNewColorButtonElement = getNewColorButton ( attribute ) ;
36
37
const getRemoveColorButtonElement = getRemoveNewColorButton ( attribute ) ;
37
-
38
+ const getResultBtn = document . getElementById ( 'getResultBtn' ) ;
38
39
let gradientBackgroundInputs = getAllInputElements ( 'gradient-background' ) ;
39
40
40
41
const getDegreeElement = getRange ( attribute ) ;
@@ -46,6 +47,22 @@ export function gradientBackgroundGenerator(
46
47
type : 'newResults' | 'oldResults' | null
47
48
) {
48
49
if ( type === null ) return ;
50
+ // Show error when the colors are not entered.
51
+ var element = gradientBackgroundInputs [ 0 ] ;
52
+ var value = element . value ;
53
+ if ( value . length < 3 ) {
54
+ gradientBackgroundInputs . forEach ( ( ele ) => {
55
+ if ( getResultBtn ) {
56
+ getResultBtn . style . backgroundColor = 'grey' ;
57
+ }
58
+ triggerEmptyAnimation ( ele ) ;
59
+ } ) ;
60
+ return ;
61
+ } else {
62
+ if ( getResultBtn ) {
63
+ getResultBtn . style . backgroundColor = 'blue' ;
64
+ }
65
+ }
49
66
50
67
const getOutputElement = getOutput ( attribute ) ;
51
68
const resultPage = getResultPage ( ) ;
You can’t perform that action at this time.
0 commit comments