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

Addition: Toggle component #45

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

saran13raj
Copy link

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

  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@saran13raj saran13raj changed the title Toggle component Addition: Toggle component Sep 21, 2024
@saran13raj saran13raj mentioned this pull request Sep 21, 2024
2 tasks
Copy link

netlify bot commented Sep 23, 2024

Deploy Preview for fulldev-ui ready!

Name Link
🔨 Latest commit c6fb396
🔍 Latest deploy log https://app.netlify.com/sites/fulldev-ui/deploys/66f50639bd063a0008320e06
😎 Deploy Preview https://deploy-preview-45--fulldev-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@silveltman silveltman changed the base branch from main to preview September 23, 2024 12:59
Copy link
Collaborator

@silveltman silveltman left a 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">
Copy link
Collaborator

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.

Copy link
Collaborator

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">
Copy link
Collaborator

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
Copy link
Collaborator

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} />
Copy link
Collaborator

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);
Copy link
Collaborator

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.

@silveltman silveltman changed the base branch from preview to main September 24, 2024 08:22
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.

[feat]: Toggle component
2 participants