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>
639639
640640 < div class ="btn-container ">
641641 < 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+ >
643647 Get Result
644648 </ div >
645649 </ div >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 getCssOrTailwindButton ,
1515} from '../lib/getElements' ;
1616import {
17+ triggerEmptyAnimation ,
1718 copyCSSCodeToClipboard ,
1819 showPopup ,
1920 whatColorButtonShouldShow ,
@@ -34,7 +35,7 @@ const attribute = 'gradient-background';
3435
3536const getNewColorButtonElement = getNewColorButton ( attribute ) ;
3637const getRemoveColorButtonElement = getRemoveNewColorButton ( attribute ) ;
37-
38+ const getResultBtn = document . getElementById ( 'getResultBtn' ) ;
3839let gradientBackgroundInputs = getAllInputElements ( 'gradient-background' ) ;
3940
4041const getDegreeElement = getRange ( attribute ) ;
@@ -46,6 +47,22 @@ export function gradientBackgroundGenerator(
4647 type : 'newResults' | 'oldResults' | null
4748) {
4849 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+ }
4966
5067 const getOutputElement = getOutput ( attribute ) ;
5168 const resultPage = getResultPage ( ) ;
You can’t perform that action at this time.
0 commit comments