-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
chore: Add checkbox-controlled
example
#950
chore: Add checkbox-controlled
example
#950
Conversation
This pull request is being automatically deployed with Vercel (learn more). reakit – ./🔍 Inspect: https://vercel.com/ariakit/reakit/ANLjFvaPET8mw5GRLEyBjCYKYZ1q [Deployment for eb47aea canceled] ariakit – ./🔍 Inspect: https://vercel.com/ariakit/ariakit/79fhpg59qvFtdUxMda4mE7Lc2y7m |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Codecov Report
@@ Coverage Diff @@
## v2 #950 +/- ##
==========================================
+ Coverage 42.12% 42.17% +0.05%
==========================================
Files 155 156 +1
Lines 4107 4111 +4
Branches 1158 1158
==========================================
+ Hits 1730 1734 +4
Misses 2376 2376
Partials 1 1
Continue to review full report at Codecov.
|
packages/ariakit/src/checkbox/__examples__/controlled-checkbox/index.tsx
Outdated
Show resolved
Hide resolved
packages/ariakit/src/checkbox/__examples__/controlled-checkbox/index.tsx
Outdated
Show resolved
Hide resolved
packages/ariakit/src/checkbox/__examples__/controlled-checkbox/index.tsx
Outdated
Show resolved
Hide resolved
Also, let's rename the example to |
136ad81
to
d5d4840
Compare
<Checkbox | ||
className="checkbox" | ||
checked={checked} | ||
onChange={(e) => setChecked(e.target.checked)} |
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.
Let's be more explicit since it's going to be part of the documentation. I'll see if there's an eslint rule for this.
onChange={(e) => setChecked(e.target.checked)} | |
onChange={(event) => setChecked(event.target.checked)} |
.label { | ||
@apply flex flex-row items-center gap-2; | ||
} | ||
|
||
.checkbox { | ||
@apply ariakit-focus-visible:ariakit-outline; | ||
} |
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.
Does it work if we just import the base checkbox styles?
.label { | |
@apply flex flex-row items-center gap-2; | |
} | |
.checkbox { | |
@apply ariakit-focus-visible:ariakit-outline; | |
} | |
@import url("../checkbox/style.css"); |
render(<Example />); | ||
expect(getByRole("checkbox")).toMatchInlineSnapshot(` |
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 guess we should use container
here.
render(<Example />); | |
expect(getByRole("checkbox")).toMatchInlineSnapshot(` | |
const { container } = render(<Example />); | |
expect(container).toMatchInlineSnapshot(` |
checkbox-controlled
example
d5d4840
to
9b438a3
Compare
9b438a3
to
49cb06b
Compare
49cb06b
to
eb47aea
Compare
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 @AlexMunoz! ❤️
Add
controlled checkbox
example #939The default example is when the checkbox is uncontrolled. #949