Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(get-results): empty results on clicking "Get Results" #523

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything here, not part of your issue

Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ <h1>Gradient Text</h1>
<div class="btn" data-button="gradient-text">Get Results</div>
</div>
</div>
<div id="error-message" class="error-message">
Please fill in all color inputs.
</div>
<!-- End of Gradient Text -->

<!-- Gradient Border -->
Expand Down
21 changes: 21 additions & 0 deletions src/pages/gradient-text.ts
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything that has to do with the error message, look at how prevention of open get results page and just implement it the same.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay thanks i will work on that

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ export function gradientTextGenerator(

const getInputElement = getInputText(attribute);

// Check if any of the color inputs is empty
let colorInputsEmpty = false;
for (const input of gradientTextInputs) {
if (input.id.startsWith('gradient-text-color') && input.value === '') {
colorInputsEmpty = true;
break;
}
}
if (colorInputsEmpty) {
// Show an error message on the screen
const errorMessageElement = document.getElementById('error-message');
errorMessageElement.textContent = 'Please fill in all color inputs.';
errorMessageElement.style.display = 'block';

// Prevent further action
setTimeout(() => {
errorMessageElement.style.display = 'none';
}, 3000); // 5000 milliseconds (5 seconds)
return;
}

if (getInputElement.value.length === 0) {
getOpenSideBarButton().style.display = 'none';
triggerEmptyAnimation(getInputElement);
Expand Down
9 changes: 9 additions & 0 deletions src/style.css
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything here, not part of your issue

Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,15 @@ a {
}
}

.error-message {
/* background-color: rgb(15, 9, 9); */
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
text-align: center;
margin-top: 20px;
}

@media screen and (max-width: 500px) {
.box-shadow-preview {
--box-size: 70px;
Expand Down
Loading