Skip to content

Commit

Permalink
Prevent Result Page display when colors are not entered
Browse files Browse the repository at this point in the history
  • Loading branch information
saakshiraut28 committed Aug 16, 2023
1 parent 68c1005 commit 6b98c6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ <h2>
placeholder="Tap to pick a color"
id="gradient-background-color1"
class="gradient-background-inputs"
required
/>
</label>

Expand All @@ -597,6 +598,7 @@ <h2>
placeholder="Tap to pick a color"
id="gradient-background-color2"
class="gradient-background-inputs"
required
/>
</label>
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/pages/gradient-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
getCssOrTailwindDropdown,
getTailwindButton,
getCssOrTailwindButton,
getInputText,
} from '../lib/getElements';
import {
copyCSSCodeToClipboard,
Expand All @@ -24,6 +25,7 @@ import {
getColorsValue,
closeDropdown,
copyTailwindCodeToClipboard,
triggerEmptyAnimation,
} from '../lib/packages/utils';

type Values = {
Expand All @@ -47,6 +49,12 @@ export function gradientBackgroundGenerator(
) {
if (type === null) return;

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

const getOutputElement = getOutput(attribute);
const resultPage = getResultPage();

Expand Down

0 comments on commit 6b98c6d

Please sign in to comment.