Skip to content

Commit

Permalink
Fixed if condition when handling labelPosition in Radio Astro com…
Browse files Browse the repository at this point in the history
…ponent (#2198)
  • Loading branch information
smmr-dn authored Aug 21, 2024
1 parent 8f739ed commit 715ddec
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions apps/css-workshop/src/components/Radio.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
name: string;
} & astroHTML.JSX.HTMLAttributes;
const { disabled, status, class: className, labelPosition, ...props } = Astro.props;
const { disabled, status, class: className, labelPosition = 'right', ...props } = Astro.props;
---

<label
Expand All @@ -22,22 +22,17 @@ const { disabled, status, class: className, labelPosition, ...props } = Astro.pr
>
{
labelPosition === 'left' && (
<>
<span class='iui-radio-label'>
<slot />
</span>
</>
<span class='iui-radio-label'>
<slot />
</span>
)
}
<input class:list={['iui-radio', className]} type='radio' disabled={disabled} {...props} />
{
labelPosition === 'right' ||
(!labelPosition && (
<>
<span class='iui-radio-label'>
<slot />
</span>
</>
))
labelPosition === 'right' && (
<span class='iui-radio-label'>
<slot />
</span>
)
}
</label>

0 comments on commit 715ddec

Please sign in to comment.