Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Paragraph): Remove deprecated as prop #1905

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
},
};
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
Loading