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

[Admin] Add text_area component #5351

Conversation

waiting-for-dev
Copy link
Contributor

@waiting-for-dev waiting-for-dev commented Aug 18, 2023

Summary

As the logic and styling for the associated label, hint and error messages are the same as for the text_field component, we extract it into a couple of new components: one for the label and one for the guidance (hint and error messages). These new components are marked as private, as they are not meant to be used directly (at least for now).

The original text_field component and the new text_area compose the new components but keep the responsibility of how to render the form inputs and which classes or attributes to use. We consider this approach more flexible than, for instance, using inheritance. Although it requires more code than just sharing a bunch of common styles, we keep them decoupled so they can change independently.

We stop short of creating another form element component wrapping new extracted pure input and textarea components. We can do that in the future if we need to.

The first three commits in this PR fix a couple of small issues in the text_field component.

Ref. #5329

screenshot-localhost_3000-2023 08 18-11_51_32

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

Copy link
Contributor

@rainerdema rainerdema left a comment

Choose a reason for hiding this comment

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

🌟 Amazing work! 🌟

As the logic and styling for the associated label, hint and error
messages are the same as for the text_field component, we extract it
into a couple of new components: one for the label and one for the
guidance (hint and error messages). These new components are marked as
private, as they are not meant to be used directly (at least for now).

The original text_field component and the new text_area compose the new
components but keep the responsibility of how to render the form
inputs and which classes or attributes to use. We consider this
approach more flexible than, for instance, using inheritance. Although
it requires more code than just sharing a bunch of common styles, we
keep them decoupled so they can change independently.

We stop short of creating another form element component wrapping new
extracted pure input and textarea components. We can do that in the
future if we need to.

Ref. solidusio#5329
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/admin/text_area_component branch from fde9b78 to 65a754d Compare August 21, 2023 10:28
@waiting-for-dev waiting-for-dev merged commit 9d46075 into solidusio:nebulab/admin Aug 21, 2023
1 of 8 checks passed
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/admin/text_area_component branch August 21, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants