Skip to content

Commit 8b9bc2c

Browse files
committed
FIX: better naming
1 parent a1a0ba9 commit 8b9bc2c

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

apps/website/src/routes/docs/headless/checkbox/examples/test-list.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
22
import { CheckboxIndicator } from 'packages/kit-headless/src/components/checkbox/checkbox-indicator';
33
import { Checkbox } from 'packages/kit-headless/src/components/checkbox/checkbox';
44
import { CheckList } from 'packages/kit-headless/src/components/checkbox/checklist';
5+
import { ChecklistIndicator } from '@qwik-ui/headless';
56
export default component$(() => {
67
return (
78
<>
@@ -12,21 +13,28 @@ export default component$(() => {
1213
class="flex items-center gap-3 bg-slate-900 p-2 text-white"
1314
checkList={true}
1415
>
15-
<CheckboxIndicator class=" flex w-[80px] justify-center bg-white p-3">
16-
17-
</CheckboxIndicator>
18-
<p>Controlls all</p>
16+
<ChecklistIndicator class="w-fit bg-black">
17+
<div q:slot="checkbox" id="true-img">
18+
19+
</div>
20+
21+
<div q:slot="checklist" id="mixed-img">
22+
23+
</div>
24+
</ChecklistIndicator>
25+
26+
<p>Get All</p>
1927
</Checkbox>
2028

2129
<Checkbox class="flex items-center gap-3 bg-slate-900 pr-2 text-white">
2230
<CheckboxIndicator class="w-fit bg-slate-600"></CheckboxIndicator>
23-
<p>No other stuff is needed here</p>
31+
<p>Cat One</p>
2432
</Checkbox>
2533

2634
<Checkbox class="bg-slate-900 text-white">
2735
<div class="flex items-center gap-3">
2836
<CheckboxIndicator class="w-fit bg-slate-600"></CheckboxIndicator>
29-
<p>No other stuff is needed here</p>
37+
<p>Cat Two</p>
3038
</div>
3139
</Checkbox>
3240
</CheckList>

packages/kit-headless/src/components/checkbox/checkbox.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@builder.io/qwik';
1313
import { CheckListContext, CheckboxContext } from './context-id';
1414
import { TriBool, getTriBool } from './checklist-context-wrapper';
15-
export type TriStateCheckboxProps = {
15+
export type MixedStateCheckboxProps = {
1616
checkBoxSig?: Signal<boolean>;
1717
checkList?: boolean;
1818
_useCheckListContext?: boolean;
@@ -32,16 +32,16 @@ export type ChecklistTwoStateCheckboxProps = {
3232
_useCheckListContext?: boolean;
3333
_overWriteCheckbox?: boolean;
3434
} & PropsOf<'div'>;
35-
export const Checkbox = component$<TriStateCheckboxProps>((props) => {
35+
export const Checkbox = component$<MixedStateCheckboxProps>((props) => {
3636
// this is done to avoid consumers dealing with two types checkboxes, could go in different files
3737
if (props._useCheckListContext && !props.checkList) {
3838
console.log('using chechlist');
3939
}
4040
if (props.checkList) {
4141
return (
42-
<TriStateCheckbox {...props}>
42+
<MixedStateCheckbox {...props}>
4343
<Slot />
44-
</TriStateCheckbox>
44+
</MixedStateCheckbox>
4545
);
4646
}
4747
if (props._useCheckListContext) {
@@ -145,7 +145,7 @@ export const ChecklistTwoStateCheckbox = component$<ChecklistTwoStateCheckboxPro
145145
},
146146
);
147147

148-
export const TriStateCheckbox = component$<TriStateCheckboxProps>((props) => {
148+
export const MixedStateCheckbox = component$<MixedStateCheckboxProps>((props) => {
149149
// all the sig stuff should be refactored into a fancy hook
150150
const checklistContext = useContext(CheckListContext);
151151
const childCheckboxes = checklistContext.checkboxes;

packages/kit-headless/src/components/checkbox/checklist.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export const CheckList: Component<CheckListProps> = (props: CheckListProps) => {
8989

9090
return (
9191
<>
92-
{checkArr.length}
9392
<ChecklistContextWrapper
9493
ariaLabeledBy={props.ariaLabeledBy}
9594
arrSize={boolArr.length}

0 commit comments

Comments
 (0)