-
Notifications
You must be signed in to change notification settings - Fork 4
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: input component #221
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: e642045 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Thank you @jaimefps this is a great start,
I took the liberty of adding the vue implementation.
I have a few questions that you could probably answser easily.
The typescript engine seems to work for me, I did not see your issues. Mybe it's a matter of restarting the TS server, maybe it's a git clean
problem.
const usePropagateFocusProps = () => { | ||
const [hasFocus, setHasFocus] = React.useState(false) | ||
const enableFocusStyle = React.useCallback(() => setHasFocus(true), []) | ||
const disableFocusStyle = React.useCallback(() => setHasFocus(false), []) | ||
const propagateFocusProps = React.useMemo(() => { | ||
return { | ||
onFocus: enableFocusStyle, | ||
onMouseEnter: enableFocusStyle, | ||
onMouseOver: enableFocusStyle, | ||
onBlur: disableFocusStyle, | ||
onMouseLeave: disableFocusStyle, | ||
onMouseOut: disableFocusStyle, | ||
} | ||
}, [enableFocusStyle, disableFocusStyle]) | ||
return { | ||
propagateFocusProps, | ||
hasFocus, | ||
} | ||
} |
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.
Changing the style on focus is usually easier to build using tools like focus-within
.
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.
Is there an example of it in a react component at this time, it seems you've only done it in vue atm?
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.
it is actually pure css... I'll modify this with an example.
const Contrast = ({ children }) => ( | ||
<div className="bg-white p-[2px] rounded">{children}</div> | ||
) |
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.
Since we had to create this blob, my guts tell me that "by default" inputs should have a background. That's an opinion though.
Why did you decide to not add it?
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 disabled state doesn't contrast well with the default color of the container in the first generated sample, but I'll remove since we don't need it anymore. Moreover, from the figma designs, it seems that the only think distinguishing dark/light mode inputs is the background, so I'll add that based on the same pattern you did for the dark-mode in the tabs component.
Creates Text Input component as shown in Figma.