Skip to content

Commit

Permalink
feat: rename size prop to data-size (#2680)
Browse files Browse the repository at this point in the history
resolves #2673
  • Loading branch information
Barsnes authored Oct 25, 2024
1 parent acef771 commit d2fc6b9
Show file tree
Hide file tree
Showing 123 changed files with 1,035 additions and 2,026 deletions.
2 changes: 1 addition & 1 deletion apps/_components/src/ClipboardButton/ClipboardButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ClipboardButton = ({
icon={!text}
variant='tertiary'
color='neutral'
size='sm'
data-size='sm'
>
<ClipboardIcon fontSize={'1.4rem'} />
{text && <span className={classes.text}>{text}</span>}
Expand Down
2 changes: 1 addition & 1 deletion apps/_components/src/CodeSnippet/CodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const CodeSnippet = ({
aria-label='Kopier'
icon
color='neutral'
size='sm'
data-size='sm'
>
<FilesIcon fontSize='1.5rem' />
</Button>
Expand Down
6 changes: 3 additions & 3 deletions apps/_components/src/ColorModal/ColorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const Field = ({
return (
<div className={classes.field}>
{label && (
<Paragraph size='sm' className={classes.label}>
<Paragraph data-size='sm' className={classes.label}>
{label}
</Paragraph>
)}
<Paragraph size='sm' className={classes.value}>
<Paragraph data-size='sm' className={classes.value}>
{value}
</Paragraph>
{copyBtn && <ClipboardButton value={value} />}
Expand Down Expand Up @@ -61,7 +61,7 @@ export const ColorModal = ({
backdropClose
>
<Modal.Block>
<Heading size='xs'>
<Heading data-size='xs'>
{`${capitalizeFirstLetter(namespace)} ${capitalizeFirstLetter(getColorNameFromNumber(weight))}`}
</Heading>
</Modal.Block>
Expand Down
12 changes: 7 additions & 5 deletions apps/_components/src/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const Footer = forwardRef<HTMLElement, FooterProps>(function Footer(
<div className={classes.top}>
<Container className={classes.container}>
<div>
<Heading size='xs' level={2} className={classes.title}>
<Heading data-size='xs' level={2} className={classes.title}>
Lages på tvers av offentlige etater:
</Heading>
<div className={classes.logos}>
Expand All @@ -64,7 +64,7 @@ export const Footer = forwardRef<HTMLElement, FooterProps>(function Footer(
<Mattilsynet />
<Udir className={classes.udir} />
</div>
<Button asChild variant='secondary' color='neutral' size='sm'>
<Button asChild variant='secondary' color='neutral' data-size='sm'>
<NextLink
href='mailto:[email protected]'
className={classes.button}
Expand All @@ -74,13 +74,13 @@ export const Footer = forwardRef<HTMLElement, FooterProps>(function Footer(
</Button>
</div>
<div>
<Heading size='xs' level={2} className={classes.title}>
<Heading data-size='xs' level={2} className={classes.title}>
Om nettstedet
</Heading>
{LinkList(centerLinks)}
</div>
<div>
<Heading size='xs' level={2} className={classes.title}>
<Heading data-size='xs' level={2} className={classes.title}>
Kom i kontakt med oss
</Heading>
{LinkList(rightLinks)}
Expand All @@ -89,7 +89,9 @@ export const Footer = forwardRef<HTMLElement, FooterProps>(function Footer(
</div>
<div className={classes.bottom}>
<Container>
<Paragraph size='sm'>© {getCurrentYear()} Designsystemet</Paragraph>
<Paragraph data-size='sm'>
© {getCurrentYear()} Designsystemet
</Paragraph>
</Container>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion apps/_components/src/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const Header = ({ menu, betaTag, skipLink = true }: HeaderProps) => {
>
{menu.map((item, index) => (
<li className={classes.item} key={index}>
<Paragraph size='md' asChild>
<Paragraph data-size='md' asChild>
<Link
suppressHydrationWarning
href={item.href}
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/app/(frontpage)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Layout = ({ children }: { children: React.ReactNode }) => {
<Container className={classes.container}>
<div className={classes.text}>
<div className={classes.betaTag}>Next</div>
<Heading size='lg'>
<Heading data-size='lg'>
Designsystemet hjelper deg å lage gode digitale tjenester
</Heading>
</div>
Expand Down
8 changes: 4 additions & 4 deletions apps/storefront/app/bloggen/_components/Card/BlogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export const BlogCard = ({
</CardBlock>
<CardBlock>
{tagText && (
<Tag className={classes.tag} color={tagColor} size='sm'>
<Tag className={classes.tag} color={tagColor} data-size='sm'>
{tagText}
</Tag>
)}
<Heading level={level} size={featured ? 'lg' : 'sm'}>
<Heading level={level} data-size={featured ? 'lg' : 'sm'}>
<Link href={href}>{title}</Link>
</Heading>
<Paragraph size={featured ? 'lg' : 'sm'}>{desc}</Paragraph>
<Paragraph size={featured ? 'md' : 'xs'} className={classes.meta}>
<Paragraph data-size={featured ? 'lg' : 'sm'}>{desc}</Paragraph>
<Paragraph data-size={featured ? 'md' : 'xs'} className={classes.meta}>
{author ||
(date && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export const Contributors = ({ authors }: ContributorsProps) => {
className={classes.logoImage}
/>
</div>
<Heading level={3} size='2xs'>
<Heading level={3} data-size='2xs'>
Bidragsytere
</Heading>
<Paragraph size='sm' className={classes.meta}>
<Paragraph data-size='sm' className={classes.meta}>
{authors?.map((author, index) => (
<Fragment key={index}>
{index !== 0 && <span aria-hidden className={classes.metaSquare} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function PostLayout({
<Paragraph className={classes.ingress} variant='long'>
{ingress}
</Paragraph>
<Paragraph size='sm' className={classes.meta}>
<Paragraph data-size='sm' className={classes.meta}>
<span>{date}</span>
<span aria-hidden className={classes.metaSquare} />
<span>{author}</span>
Expand All @@ -67,10 +67,10 @@ function PostLayout({
<MdxContent className={classes.content}>
{content}
<div className={classes.wantToWrite}>
<Heading level={3} size='xs'>
<Heading level={3} data-size='xs'>
Ønsker du å skrive for bloggen?
</Heading>
<Paragraph size='sm'>
<Paragraph data-size='sm'>
Ta kontakt med oss på{' '}
<Link
href='https://join.slack.com/t/designsystemet/shared_invite/zt-2438eotl3-a4266Vd2IeqMWO8TBw5PrQ'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Alle brukerne, også de med svekket syn, skal kunne se innholdet i digitale tjen
<Card color='brand3' data-unstyled>
<Heading
level={3}
size='xs'
data-size='xs'
>Gjeldende regelverk, WCAG 2.1</Heading>
<ListUnordered>
<ListItem>
Expand All @@ -63,7 +63,7 @@ Alle brukerne, også de med svekket syn, skal kunne se innholdet i digitale tjen
<Card color='brand2' data-unstyled>
<Heading
level={3}
size='xs'
data-size='xs'
>Fremtidig eller strengere:</Heading>
<ListUnordered>
<ListItem>
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/app/grunnleggende/for-designere/terskel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Skriv noe om HSL,

Om du ønsker å lage dine egne farger, kan du bruke tabellen under for å passe på at du holder deg innenfor terkskelverdiene for den gitte fargen.

<Table size='md'>
<Table data-size='md'>
<Table.Head>
<Table.Row>
<Table.HeaderCell>Navn</Table.HeaderCell>
Expand All @@ -31,4 +31,4 @@ Om du ønsker å lage dine egne farger, kan du bruke tabellen under for å passe

#### Kontrastfarger

med eksempler
med eksempler
2 changes: 1 addition & 1 deletion apps/storefront/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const NotFound = ({ children }: { children: React.ReactNode }) => {
/>
</div>
<div className={classes.textContainer}>
<Heading size='md'>Denne siden finnes ikke</Heading>
<Heading data-size='md'>Denne siden finnes ikke</Heading>
<Paragraph>
Beklager, vi finner ikke siden du ba om. Siden kan være flyttet
eller slettet.
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const BannerRoot = ({
type BannerHeadingProps = Omit<HeadingProps, 'size'>;

const BannerHeading = ({ ...props }: BannerHeadingProps) => {
return <Heading size='lg' {...props} />;
return <Heading data-size='lg' {...props} />;
};

type BannerIngressProps = HTMLAttributes<HTMLParagraphElement>;
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/components/ComponentCard/ComponentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ComponentCard = ({ title, image, url }: ComponentCardProps) => {
alt={title}
className={classes.image}
/>
<Heading size='xs' className={classes.title} level={2}>
<Heading data-size='xs' className={classes.title} level={2}>
{title}
</Heading>
</NextLink>
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/components/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Image = ({
aria-label={alt}
></img>
{caption && (
<Paragraph size='sm' asChild>
<Paragraph data-size='sm' asChild>
<figcaption>{caption}</figcaption>
</Paragraph>
)}
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/components/ImageBanner/ImageBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ const ImageBanner = ({

<div className={classes.textContainer}>
{title ? (
<Heading level={2} size='lg' className={classes.title}>
<Heading level={2} data-size='lg' className={classes.title}>
{title}
</Heading>
) : null}
{description && <Paragraph size='lg'>{description}</Paragraph>}
{description && <Paragraph data-size='lg'>{description}</Paragraph>}
{content && content}
{link && (
<Link className={classes.link} color='neutral' asChild>
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/components/NavigationCard/NavigationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const NavigationCard = ({
<Link href={url} prefetch={false}>
<div className={cl(classes.iconContainer, classes[color])}>{icon}</div>

<Heading level={level} size='sm' className={classes.title}>
<Heading level={level} data-size='sm' className={classes.title}>
{title}
</Heading>

<Paragraph size='sm' variant='long' className={classes.desc}>
<Paragraph data-size='sm' variant='long' className={classes.desc}>
{description}
</Paragraph>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/components/Section/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Section = ({
<Container>
<div className={classes.header}>
{title && (
<Heading level={2} size='md'>
<Heading level={2} data-size='md'>
{title}
</Heading>
)}
Expand Down
10 changes: 5 additions & 5 deletions apps/storefront/components/SidebarMenu/SidebarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const SidebarMenu = ({ routerPath }: SidebarMenuProps) => {
<>
<Button
className={classes.toggleBtn}
size='md'
data-size='md'
color='neutral'
variant='secondary'
onClick={() => setShowMenu(!showMenu)}
Expand All @@ -50,7 +50,7 @@ const SidebarMenu = ({ routerPath }: SidebarMenuProps) => {
</Button>

<div className={cl(classes.menu, showMenu && classes.activeMenu)}>
<Paragraph size='md' asChild>
<Paragraph data-size='md' asChild>
<h3 className={classes.title}>
{SiteConfig.menu[activeIndex].name}
</h3>
Expand All @@ -66,14 +66,14 @@ const SidebarMenu = ({ routerPath }: SidebarMenuProps) => {
>
{item.children && (
<>
<Paragraph asChild size='md'>
<Paragraph asChild data-size='md'>
<div className={classes.innerTitle}>{item.name}</div>
</Paragraph>
<ul className={classes.innerList}>
{item.children.map(
(item2: PageMenuItemType, index2) => (
<li key={index2} className={classes.listItem}>
<Paragraph asChild size='sm'>
<Paragraph asChild data-size='sm'>
<Link
href={'/' + item2.url}
prefetch={false}
Expand All @@ -93,7 +93,7 @@ const SidebarMenu = ({ routerPath }: SidebarMenuProps) => {
</>
)}
{!item.children && (
<Paragraph asChild size='sm'>
<Paragraph asChild data-size='sm'>
<Link
href={'/' + item.url}
prefetch={false}
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/components/TeaserCard/TeaserCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TeaserCard = ({
}: TeaserCardProps) => {
return (
<Link className={classes.card} href={href} prefetch={false}>
<Heading level={3} size='sm' className={classes.title}>
<Heading level={3} data-size='sm' className={classes.title}>
{title}
</Heading>
<p className={classes.desc}>{description}</p>
Expand Down
6 changes: 3 additions & 3 deletions apps/storefront/components/Tokens/TokenList/TokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const TokenCards = ({ tokens, cols, hideValue, type }: TokenCardsProps) => {
return tokens.map(([group, tokens]) => {
return (
<div key={group}>
<Heading size='xs' level={4} className={classes.title}>
<Heading data-size='xs' level={4} className={classes.title}>
{capitalizeString(group)}
</Heading>
<div className={cl(classes.group)}>
Expand Down Expand Up @@ -144,7 +144,7 @@ const TokenCard = ({ token, type, hideValue, ...rest }: TokenCardProps) => {
</div>

<div className={classes.textContainer}>
<Heading level={5} size='2xs' className={classes.name}>
<Heading level={5} data-size='2xs' className={classes.name}>
{weight ? getColorNameFromNumber(weight) : capitalizeString(title)}
&nbsp;
<ClipboardButton
Expand Down Expand Up @@ -215,7 +215,7 @@ const TokenList = ({
className={classes.npmShield}
/>
</Link>
<Paragraph size='sm'>@digdir/designsystemet-theme</Paragraph>
<Paragraph data-size='sm'>@digdir/designsystemet-theme</Paragraph>
</div>
{(showThemePicker || showModeSwitcher) && (
<div className={classes.toggleGroup}>
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/layouts/MenuPageLayout/MenuPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const MenuPageLayout = ({ content, data, banner }: PageLayoutProps) => {
{data && (
<div className={classes.header}>
<div className={classes.headerText}>
<Heading size='lg'>{data.title}</Heading>
<Heading data-size='lg'>{data.title}</Heading>
{data.date && <div className={classes.date}>{data.date}</div>}
</div>
<div
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/layouts/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ const PageLayout = ({ content, data }: PageLayoutProps) => {
{data.backText}
</NextLink>
</Link>
<Paragraph size='lg' variant='short' asChild>
<Paragraph data-size='lg' variant='short' asChild>
<div className={classes.meta}>
<span>{data.author && <span>{data.author}</span>}</span>
<span className={classes.separator}> - </span>
<span>{data.date && <div>{data.date}</div>}</span>
</div>
</Paragraph>
<Heading level={1} size='lg' className={classes.title}>
<Heading level={1} data-size='lg' className={classes.title}>
{data.title}
</Heading>
</div>
Expand Down
Loading

0 comments on commit d2fc6b9

Please sign in to comment.