Skip to content

Commit 57d1d49

Browse files
Try extra clever version
1 parent c272dd1 commit 57d1d49

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

app/forms/access-util.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function RoleRadioField<
106106
className="mt-2"
107107
>
108108
{R.reverse(allRoles).map((role) => (
109-
<Radio name="roleName" key={role} value={role} alignTop>
109+
<Radio name="roleName" key={role} value={role}>
110110
<div className="text-sans-md text-raise">
111111
{capitalize(role).replace('_', ' ')}
112112
</div>

app/ui/lib/Checkbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export const Checkbox = ({
4646
className,
4747
...inputProps
4848
}: CheckboxProps) => (
49-
<label className="items-top inline-flex">
50-
<span className="relative h-4 w-4">
49+
<label className="text-sans-md items-top inline-flex">
50+
<span className="relative mt-[calc((1lh-16px)/2)] h-4 w-4">
5151
<input
5252
className={cn(inputStyle, className)}
5353
type="checkbox"

app/ui/lib/Radio.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ import cn from 'classnames'
1717
import type { ComponentProps } from 'react'
1818

1919
// input type is fixed to "radio"
20-
export type RadioProps = Omit<React.ComponentProps<'input'>, 'type'> & {
21-
/** Align radio button with top of content instead of center (useful for multi-line content) */
22-
alignTop?: boolean
23-
}
20+
export type RadioProps = Omit<React.ComponentProps<'input'>, 'type'>
2421

2522
const fieldStyles = `
2623
peer appearance-none absolute outline-hidden
@@ -29,9 +26,9 @@ const fieldStyles = `
2926
disabled:hover:bg-transparent
3027
`
3128

32-
export const Radio = ({ children, className, alignTop, ...inputProps }: RadioProps) => (
33-
<label className={cn('inline-flex', alignTop ? 'items-start' : 'items-center')}>
34-
<span className="relative h-4 w-4 shrink-0">
29+
export const Radio = ({ children, className, ...inputProps }: RadioProps) => (
30+
<label className="text-sans-md inline-flex items-start">
31+
<span className="relative mt-[calc((1lh-16px)/2)] h-4 w-4 shrink-0">
3532
<input className={cn(fieldStyles, className)} type="radio" {...inputProps} />
3633
{/* the dot in the middle. hide by default, use peer-checked to show if checked */}
3734
<div className="bg-accent pointer-events-none absolute top-1 left-1 hidden h-2 w-2 rounded-full peer-checked:block" />

0 commit comments

Comments
 (0)