-
Notifications
You must be signed in to change notification settings - Fork 87
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(design-system): add Input, Textarea component and stories #2246
Conversation
5f5f818
to
4512c81
Compare
used to automatically resize text areas
This is used in by Chakra's `InputGroup` component to remove border radii when paired with `InputLeftAddon` or `InputRightAddon`
this removes the need to have a per-input component memoization theme override
since they follow input state, no reason to not include those
also removed redundant isSuccess check
so react won't throw an error on the console
if (!props.isSuccess) { | ||
return <ChakraInput ref={ref} {...inputProps} sx={inputStyles.field} /> | ||
} |
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.
sorry why are we doing this?
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.
As per the comments in the non-success case, InputGroup
is required for InputRightElement
to retrieve the correct style props and will crash if not included.
However, since we just display the normal input on success, we do not need that special requirement and can just return the input as per normal
# Conflicts: # frontend/src/assets/icons/BxsCheckCircle.tsx # frontend/src/theme/components/index.ts
# Conflicts: # frontend/package-lock.json # frontend/package.json # frontend/src/theme/components/index.ts
wrong indentation sorry
boxShadow: 'none', | ||
borderColor: 'primary.500', | ||
borderWidth: '2px', | ||
outline: (props: Record<string, any>) => { |
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.
lol
<InputGroup> | ||
<ChakraInput ref={ref} {...inputProps} sx={inputStyles.field} /> | ||
<InputRightElement sx={inputStyles.success}> | ||
<Icon as={BxsCheckCircle} /> | ||
</InputRightElement> | ||
</InputGroup> |
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.
Could i clarify on why we chose to do this? Testing on chakra's website seems to suggest that there are styling conflicts and consumers of our component might mistakenly think that this is a base Input
in success state and compose it as part of an InputGroup
only to discover that it's actually not.
Problem
This PR adds the
components/Input
component alongside with their stories. A Playground story is also created to check how it could work with React hook form.Closes #2002
Solution
Features:
Before & After Screenshots
In storybook