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

Issue #82 - Handle invalid colors in variant modals #86

Merged
merged 2 commits into from
Mar 4, 2023

Conversation

prichter
Copy link
Contributor

@prichter prichter commented Mar 3, 2023

Summary
This PR is a fix for issue #82. Previously, saving a new or edited variant color would permit, and save, invalid CSS color values. This fix adds error checking and Input highlighting prior to save, following the same convention as in the onboarding name page.

Description
Implementation is the same in both the AddVariantModal and the EditVariantModal in that an error variable is created, and used to highlight incorrect / missing syntax on the color inputs within the modal. A new Text Chakra component is added beneath each input to display relevant error message.

The validation is done by saving the initial value, and applying the handleInvalidCss util to the input color, then checking for differences, and setting the error message in the event that there is a difference (ie. the handleInvalidCss has changed the value).

@alexdanilowicz
Copy link
Contributor

Just qa-ed, and pushed up some formatting because I don't think you have prettier set up. (DM-ed you about this). Fantastic work yet again.

@alexdanilowicz alexdanilowicz merged commit ed5a774 into magicpatterns:main Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants