Skip to content

Commit

Permalink
fix: correct cursor for checkbox, spacing between checkboxes and disa…
Browse files Browse the repository at this point in the history
…ble border for spacer
  • Loading branch information
GoldElysium committed Aug 4, 2024
1 parent 64c0c6e commit a9ff133
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/components/ui/form/ui/blocks/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function CheckboxFabric(props: {
return (
<div className="w-full">
<label
className="relative inline-flex min-h-5 select-none items-center"
className="relative inline-flex min-h-5 cursor-pointer select-none items-center"
>
<input
className="absolute size-0 cursor-pointer opacity-0"
Expand Down
43 changes: 24 additions & 19 deletions src/components/ui/form/ui/blocks/checkboxes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,34 @@ function CheckboxesFabric(props: {
<>
{props.checkboxes.map(
(checkbox, index) => (props.view === 'preview' || checkbox.label) && (
<CheckboxFabric
key={checkbox.id || index}
label={checkbox.label}
description={checkbox.description}
required={checkbox.required}
disabled={checkbox.disabled}
readOnly={checkbox.readOnly}
error={checkbox.error}
tabIndex={checkbox.tabIndex || props.tabIndex}
tabSubmit={index + 1 === props.checkboxes.length}
value={checkbox.value}
ariaDescribedBy={props.ariaDescribedBy}
onChange={checkbox.onChange}
onAutoFocus={(index === 0 && props.onAutoFocus) || undefined}
onFocus={props.onFocus}
onBlur={props.onBlur}
onSubmit={props.onSubmit}
onCancel={(index === 0 && props.onCancel) || undefined}
/>
<>
<CheckboxFabric
key={checkbox.id || index}
label={checkbox.label}
description={checkbox.description}
required={checkbox.required}
disabled={checkbox.disabled}
readOnly={checkbox.readOnly}
error={checkbox.error}
tabIndex={checkbox.tabIndex || props.tabIndex}
tabSubmit={index + 1 === props.checkboxes.length}
value={checkbox.value}
ariaDescribedBy={props.ariaDescribedBy}
onChange={checkbox.onChange}
onAutoFocus={(index === 0 && props.onAutoFocus) || undefined}
onFocus={props.onFocus}
onBlur={props.onBlur}
onSubmit={props.onSubmit}
onCancel={(index === 0 && props.onCancel) || undefined}
/>
<hr className="my-2 border-none" />
</>
),
)}
</>
);
}

/* eslint-enable */

@tripetto({
Expand All @@ -58,6 +62,7 @@ export default class CheckboxesBlock extends Checkboxes implements IFormNodeBloc
<>
{props.name}
{props.description}
<hr className="mt-3 border-none" />
<CheckboxesFabric
checkboxes={this.checkboxes(props)}
ariaDescribedBy={props.ariaDescribedBy}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/form/ui/blocks/spacer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IFormNodeBlock } from '@/components/ui/form/interfaces/block';
export default class SpacerBlock extends Spacer implements IFormNodeBlock {
render() {
return (
<hr style={{ height: `${this.size}em` }} className="min-w-1" />
<hr style={{ height: `${this.size}em` }} className="min-w-1 border-none" />
);
}
}

0 comments on commit a9ff133

Please sign in to comment.