@@ -14,9 +14,10 @@ import {
1414 getTailwindButton ,
1515 getCssOrTailwindButton ,
1616 getCssOrTailwindDropdown ,
17- getOpenSideBarButton ,
17+ getResultButton ,
1818} from '../lib/getElements' ;
1919import {
20+ triggerEmptyAnimation ,
2021 copyCSSCodeToClipboard ,
2122 showPopup ,
2223 addRule ,
@@ -42,7 +43,6 @@ const getRemoveColorButtonElement = getRemoveNewColorButton(attribute);
4243
4344const getBorderRadiusInput = getRadiusInput ( attribute ) ;
4445const toggleRadiusInputForGradientBorder = getCheckbox ( attribute ) ;
45- const getOutputElement = getOutput ( attribute ) ;
4646
4747const getDegreeElement = getRange ( attribute ) ;
4848const resetButton = getResetButton ( attribute ) ;
@@ -51,8 +51,6 @@ const showCopyClass = 'show-css-tailwind';
5151
5252let gradientBorderInputs = getAllInputElements ( 'gradient-border' ) ;
5353
54- const resultPage = getResultPage ( ) ;
55-
5654function copyHandler ( ) {
5755 const outputElement = getOutput ( attribute ) ;
5856 copyCSSCodeToClipboard ( attribute , outputElement ) ;
@@ -106,16 +104,34 @@ export function gradientBorderGenerator(
106104 type : 'newResults' | 'oldResults' | null
107105) : void {
108106 if ( type === null ) return ;
109- const element = gradientBorderInputs [ 0 ] ;
110- const value = element . value ;
111- if ( value . length < 3 ) {
112- getOpenSideBarButton ( ) . style . display = 'none' ;
113- } else {
114- getOpenSideBarButton ( ) . style . display = 'flex' ;
115- resultPage . style . display = 'flex' ;
107+
108+ const resultBtn = getResultButton ( attribute ) ;
109+
110+ const item1 = gradientBorderInputs [ 0 ] ;
111+ const val1 = item1 . value . length ;
112+
113+ const item2 = gradientBorderInputs [ 1 ] ;
114+ const val2 = item2 . value . length ;
115+
116+ //Show error if input values are empty
117+ if ( ( resultBtn && val1 < 1 ) || val2 < 1 ) {
118+ gradientBorderInputs . forEach ( ( e ) => {
119+ if ( e . value . length === 0 ) {
120+ triggerEmptyAnimation ( e ) ;
121+ }
122+ resultBtn . style . backgroundColor = 'grey' ;
123+ } ) ;
124+ return ;
125+ } else {
126+ if ( resultBtn ) {
127+ resultBtn . style . backgroundColor = 'blue' ;
128+ }
116129 }
117-
118130
131+ const getOutputElement = getOutput ( attribute ) ;
132+ const resultPage = getResultPage ( ) ;
133+
134+ resultPage . style . display = 'flex' ;
119135 if ( type === 'oldResults' ) return ;
120136
121137 if ( ! toggleRadiusInputForGradientBorder . checked ) {
0 commit comments