Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/components/FormFields/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ type BaseCheckboxProps = {
};

interface CheckboxProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>,
BaseCheckboxProps {
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>, BaseCheckboxProps {
name: string;
}

Expand Down Expand Up @@ -58,7 +57,7 @@ export function Checkbox(props: CheckboxProps) {
variants[variant],
)}
>
<div className="grid grid-cols-[auto_1fr] items-start gap-x-2">
<div className="grid grid-cols-[auto_1fr] items-start gap-x-1">
<label className={cx('contents', disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>
{/* Native input */}
<input
Expand Down Expand Up @@ -110,19 +109,22 @@ export function Checkbox(props: CheckboxProps) {
</div>

{error && (
<FontAwesomeIcon icon={faExclamationCircle} className="h-4 w-4 text-red-400" />
<FontAwesomeIcon
icon={faExclamationCircle}
className="h-4 w-4 text-red-400 translate-y-[1px]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason we can't use padding / margin here?

If yes, it would be nice as a comment in the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
For the error icon, adding a 1px padding works just as well.
But I used translate-y-[1px] for the label, and couldn't achieve the same effect there with padding/margin.
So it made sense to do the same here. WDYT @jlndk?

/>
)}
</div>

{(error || helpText) && (
<div className="mt-1">
{error && (
<SupportText intent="error" className="pt-0">
<SupportText intent="error" className="pt-0 pb-1">
{error}
</SupportText>
)}
{helpText && (
<SupportText intent="help" className="pt-0">
<SupportText intent="help" className="pt-0 pb-1">
{helpText}
</SupportText>
)}
Expand Down
Loading