-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(text-input): adds fluid variation of text input #5830
feat(text-input): adds fluid variation of text input #5830
Conversation
Deploy preview for carbon-elements ready! Built with commit 13b93d9 |
Deploy preview for carbon-components-react ready! Built with commit 13b93d9 https://deploy-preview-5830--carbon-components-react.netlify.app |
feat(FluidForm): add fluid form component
feat(fluid-input): add context to fluid form
@@ -83,8 +91,10 @@ const TextInput = React.forwardRef(function TextInput( | |||
<div className={helperTextClasses}>{helperText}</div> | |||
) : null; | |||
|
|||
const { isFluid } = useContext(FormContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we can we make this a prop... I imagine usage of context may stem from design guide dictating that fluid is per-form basis. OTOH software designs tend to go further, which is, setting API in different levels (layers). So we can break down "per-form fluid mode" for component implementation, one is a pure mean to change fluid/regular modes (e.g. <TextInput layout="fluid">
), another is app-level mean to ensure all form items is the desired mode, e.g.:
const AppTextInput = props => {
const { useFluid } = useContext(FormContext);
return <TextInput {...props} layout={useFluid ? 'fluid' : 'regular'} />;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asudoh we decided to use context because we wanted to avoid having the user set a fluid
prop for each individual form element. Since they can only be used in the context of a FluidForm
, we wanted to make it as easy as possible for users to create a fluid form, while not allowing much deviation from design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thank you for the background @tw15egan. I tend to avoid making "syntactic sugar" thing affect system design (UX-level requirement and system design are often different animals), but I at least now see where it came from.
Another approach to achieve such syntactic sugar is introducing <FluidTextInput>
.
@aagonzales hey I removed the margin but also removed the button for now. We are slowly building the fluid form since more things need to be added in, which will happen in a separate PR. For now this mainly for the text input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preview link isn't working but since this PR is just about text input I'll go ahead and 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks and sorry for getting to this so late 🏄
References #5416
Adds fluid form component
Fluid form will handle fluid for all of the components in form
Changelog
New
FluidForm
componentCheck text inputs work and look as intended. Check fluid text input matches.