Skip to content

Commit

Permalink
fix: Switch component label and description
Browse files Browse the repository at this point in the history
font styles
  • Loading branch information
jaieds committed Dec 17, 2024
1 parent 03cebf3 commit 7f57a08
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/switch/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ export const SwitchLabel = ( {
size: 'sm' | 'md';
} ) => {
const headingClasses = {
sm: 'text-sm leading-4 font-medium',
md: 'text-base leading-5 font-medium',
sm: 'text-sm leading-5 font-medium',
md: 'text-base leading-6 font-medium',
};
const descriptionClasses = {
sm: 'text-xs leading-4 font-normal',
md: 'text-sm leading-5 font-normal',
};
const isLabelAComponent = isValidElement( label );
if ( isLabelAComponent ) {
Expand All @@ -78,11 +82,11 @@ export const SwitchLabel = ( {
const renderLabel = () => {
const { heading = '', description = '' } = label || {};
return (
<div className="space-y-1.5">
<div className="space-y-0.5">
{ heading && (
<p
className={ cn(
'text-text-primary m-0', // text-base font-medium leading-4
'text-text-primary m-0',
headingClasses[ size ],
disabled && 'text-text-disabled'
) }
Expand All @@ -93,8 +97,9 @@ export const SwitchLabel = ( {
{ description && (
<p
className={ cn(
'text-text-secondary text-sm font-normal leading-5 m-0',
disabled && 'text-text-disabled'
'text-text-secondary text-xs font-normal leading-5 m-0',
disabled && 'text-text-disabled',
descriptionClasses[ size ]
) }
>
{ description }
Expand Down

0 comments on commit 7f57a08

Please sign in to comment.