Skip to content

Commit

Permalink
Add triggerEmptyAnimation when input is not provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
saakshiraut28 committed Aug 18, 2023
1 parent 6b98c6d commit 9365e75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ <h2>
placeholder="Tap to pick a color"
id="gradient-background-color1"
class="gradient-background-inputs"
required
/>
</label>

Expand All @@ -598,7 +597,6 @@ <h2>
placeholder="Tap to pick a color"
id="gradient-background-color2"
class="gradient-background-inputs"
required
/>
</label>
</div>
Expand Down Expand Up @@ -641,7 +639,11 @@ <h2>

<div class="btn-container">
<div class="reset" data-reset="gradient-background">Reset</div>
<div class="btn" data-button="gradient-background">
<div
class="btn"
data-button="gradient-background"
id="getResultBtn"
>
Get Result
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/pages/gradient-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
getCssOrTailwindDropdown,
getTailwindButton,
getCssOrTailwindButton,
getInputText,
} from '../lib/getElements';
import {
triggerEmptyAnimation,
copyCSSCodeToClipboard,
showPopup,
whatColorButtonShouldShow,
Expand All @@ -25,7 +25,6 @@ import {
getColorsValue,
closeDropdown,
copyTailwindCodeToClipboard,
triggerEmptyAnimation,
} from '../lib/packages/utils';

type Values = {
Expand All @@ -48,10 +47,12 @@ export function gradientBackgroundGenerator(
type: 'newResults' | 'oldResults' | null
) {
if (type === null) return;

var element = gradientBackgroundInputs[0];
var value = element.value; // Get the value of the input field
if (value.length < 3) {
gradientBackgroundInputs.forEach((ele) => {
triggerEmptyAnimation(ele);
});
return;
}

Expand Down

0 comments on commit 9365e75

Please sign in to comment.