Skip to content

Commit

Permalink
change to use variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsnes committed Mar 15, 2024
1 parent a8945f4 commit 46cd592
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/react/src/components/Typography/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export type ParagraphProps = {
size?: 'xsmall' | 'small' | 'medium' | 'large';
/** Adds margin-bottom */
spacing?: boolean;
/** Reduces line-height for short paragraphs */
/** Reduces line-height for short paragraphs
* @deprecated Use `variant="short"` instead
*/
short?: boolean;
/** Increases line-height for long paragraphs */
long?: boolean;
/** Variant of the paragraph */
variant?: 'long' | 'short';
/**
* Change the default rendered element for the one passed as a child, merging their props and behavior.
* @default false
Expand All @@ -36,17 +38,13 @@ export const Paragraph: OverridableComponent<
as = 'p',
asChild,
short,
long,
variant,
...rest
},
ref,
) => {
const Component = asChild ? Slot : as;

if (long && short) {
console.error("Only one of 'long' or 'short' should be used at a time");
}

return (
<Component
ref={ref}
Expand All @@ -56,8 +54,8 @@ export const Paragraph: OverridableComponent<
{
[classes.spacing]: !!spacing,
[classes.short]: short,
[classes.long]: long,
},
variant && classes[variant],
className,
)}
{...rest}
Expand Down

0 comments on commit 46cd592

Please sign in to comment.