-
Notifications
You must be signed in to change notification settings - Fork 10
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
Addition: Toggle component #45
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fulldev-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks so much for the PR man!
Please don't be scared of all the feedback, I want people to learn so that next PR's will be even better.
Let me know if you have any questions! Short call on discord is fine too :)
{radius} | ||
{...rest} | ||
> | ||
<label class="toggle-element"> |
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.
You have the Root and in that directly a label child. You do not need both, you can combine them into one.
set as="label" on Root and remove it from the props.
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.
Now I'm thinking about it, maybe you can even use the component, so you have the right styles right away. Set a as="label" on that.
type="checkbox" | ||
class="checkbox" | ||
/> | ||
<div class="toggle-content"> |
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 don't think you need this div either, you can achieve the same result without it
{...rest} | ||
> | ||
<label class="toggle-element"> | ||
<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.
This input does not need a checkbox class. You use nested styles, so you can just use input
instead of .checkbox. Reason being is that the .checkbox class can conflict with the checkbox component
import Toggle from 'fulldev-ui/components/Toggle.astro' | ||
--- | ||
|
||
<Toggle set:html="A" toggled={true} /> |
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.
You can use html instead of set:html
} | ||
|
||
.checkbox:hover:not(:checked) ~ .toggle-content .icon { | ||
color: var(--base-9); |
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.
only 11 and 12 should be used for text colors, for a11ty contrast reasons.
Please see this documentation for detailed explenation.
Added new component
Toggle
What's the context?
Addition of new toggle component - closes #43
Rationale behind the change or addition
To have a toggle component that's similar to shadcn toggle
Quality check