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

[#52] Form components #59

Merged
merged 7 commits into from
Jan 17, 2025
Merged

[#52] Form components #59

merged 7 commits into from
Jan 17, 2025

Conversation

joshuapease
Copy link
Contributor

@joshuapease joshuapease commented Nov 11, 2024

Overview

  • Starter Form Components #52

  • Implements all of the items under "Forms" in Blueprint.

    • Adds a custom TW plugin for form inputs.
    • Turns on the selector strategy for dark mode (used to be called class). This is how we typically style components to work with dark backgrounds. Although it prevents us from doing a true light/dark mode across the entire site.

Screenshots

Text Input

CleanShot 2025-01-03 at 09 02 20@2x

Textarea

CleanShot 2025-01-03 at 09 02 57@2x

Select

CleanShot 2025-01-03 at 09 03 20@2x

Base automatically changed from jp/51-header-and-footer to jp/45-page-blocks-and-sections December 18, 2024 13:52
Base automatically changed from jp/45-page-blocks-and-sections to jp/44-base-ui-elements December 18, 2024 13:53
Base automatically changed from jp/44-base-ui-elements to 5.x December 18, 2024 13:54
@joshuapease joshuapease force-pushed the jp/52-form-components branch from d8a39e4 to 50a95ea Compare December 18, 2024 14:35
@joshuapease joshuapease changed the title [n/a] VSCode PHP Config [#52] Form components Dec 18, 2024
@joshuapease joshuapease force-pushed the jp/52-form-components branch from fa5635e to 2f08701 Compare December 18, 2024 18:26
@joshuapease joshuapease force-pushed the jp/52-form-components branch from 2f08701 to 8a1596d Compare January 3, 2025 16:52
'@apply size-20 border-0 text-blue-500 checked:bg-blue-500 min-h-0':
{},
},
'&:is([aria-invalid="true"])': {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/vigetlabs/blueprint/blob/main/config/tailwind/inputs.js#L65

The error state slightly deviates from Blueprint here.

It's worth setting aria-invalid on inputs with errors... so this lets us only modify a single attribute rather than keeping both data-state and aria-invalid in sync.

@joshuapease joshuapease marked this pull request as ready for review January 3, 2025 17:10
@@ -0,0 +1,84 @@
import plugin from 'tailwindcss/plugin'

export default plugin(({ addComponents }) => {

Choose a reason for hiding this comment

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

What do you think about styling adjustments (e.g., the design has a black background so the inputs need white outlines and pink error states)? Would that happen in here or is there a way to create some basic config values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good thought, I've put in a ticket to consider that. #65

Would you apply that same idea to the button, rich text, and other Tailwind plugins?

My interpretation of the Blueprint components is that devs will get their hands dirty and modify TW plugins & classes to their liking.

A few config options might be handy... but it could be easy to overbuild a bunch of configuration options that will only ever be set once per project (where swapping a few Tailwind classes might be a similar level of effort).

Choose a reason for hiding this comment

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

I guess the question is: where do they get their hands dirty? Is it okay having the form styles stored in this file or should they be placed directly on the fields (even if it means some duplication) so developers can access the styles without leaving the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha! Yeah, all form styles would be controlled via this plugin.

All the TW plugins are meant to be edited.

Copy link
Contributor

Choose a reason for hiding this comment

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

A few config options might be handy... but it could be easy to overbuild a bunch of configuration options that will only ever be set once per project

Yes, exactly. If you ever feel like you're wading into overbuilding waters, turn back! We don't want these to be just as much work to undo as the components are to just build from scratch.

@joshuapease joshuapease merged commit 7e92f31 into 5.x Jan 17, 2025
@joshuapease joshuapease deleted the jp/52-form-components branch January 17, 2025 13:45
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.

3 participants