Skip to content

Commit

Permalink
feat(Paragraph): Remove deprecated as prop (#1905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsnes authored Apr 30, 2024
1 parent a8b4188 commit aa81f5a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/Chip/Removable/Removable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const RemovableChip = forwardRef<HTMLButtonElement, RemovableChipProps>(
<Paragraph
asChild
size={group?.size || size}
short
variant='short'
>
<span className={classes.label}>
<span>{children}</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Chip/Toggle/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const ToggleChip = forwardRef<HTMLButtonElement, ToggleChipProps>(
<Paragraph
asChild
size={group?.size || size}
short
variant='short'
>
<span className={classes.label}>
{shouldDisplayCheckmark && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const Preview: Story = {
children:
'Personvernerklæringen gir informasjon om hvilke personopplysninger vi behandler, hvordan disse blir behandlet og hvilke rettigheter du har.',
spacing: false,
short: false,
long: false,
size: 'medium',
},
};
22 changes: 3 additions & 19 deletions packages/react/src/components/Typography/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { forwardRef } from 'react';
import cl from 'clsx';
import { Slot } from '@radix-ui/react-slot';

import type { OverridableComponent } from '../../../types/OverridableComponent';

import classes from './Paragraph.module.css';

export type ParagraphProps = {
Expand All @@ -22,23 +20,9 @@ export type ParagraphProps = {
} & HTMLAttributes<HTMLParagraphElement>;

/** Use `Paragraph` to display text with paragraph text styles. */
export const Paragraph: OverridableComponent<
ParagraphProps,
HTMLParagraphElement
> = forwardRef(
(
{
className,
size = 'medium',
spacing,
as = 'p',
asChild,
variant,
...rest
},
ref,
) => {
const Component = asChild ? Slot : as;
export const Paragraph = forwardRef<HTMLParagraphElement, ParagraphProps>(
({ className, size = 'medium', spacing, asChild, variant, ...rest }, ref) => {
const Component = asChild ? Slot : 'p';

return (
<Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const EksempelTekst: StoryFn = () => (
</Heading>

<Paragraph
short
variant='short'
spacing
>
Når du skal signere meldingen vil du motta en signeringsoppgave i
Expand Down Expand Up @@ -83,7 +83,7 @@ export const EksempelTekst: StoryFn = () => (
</Heading>

<Paragraph
short
variant='short'
spacing
>
Personvernerklæringen gir informasjon om hvilke personopplysninger vi
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/form/Fieldset/Fieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
{description && (
<Paragraph
size={size}
variant='short'
asChild
short
>
<div
id={descriptionId}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/form/Textfield/Textfield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const Textfield = forwardRef<HTMLInputElement, TextfieldProps>(
<Paragraph
asChild
size={size}
short
variant='short'
>
<div
className={cl(classes.adornment, classes.prefix)}
Expand Down Expand Up @@ -179,7 +179,7 @@ export const Textfield = forwardRef<HTMLInputElement, TextfieldProps>(
<Paragraph
asChild
size={size}
short
variant='short'
>
<div
className={cl(classes.adornment, classes.suffix)}
Expand Down

0 comments on commit aa81f5a

Please sign in to comment.