Skip to content

Commit fc46b07

Browse files
authored
chore: replace classnames with clsx
1 parent c5345f5 commit fc46b07

File tree

23 files changed

+61
-66
lines changed

23 files changed

+61
-66
lines changed

apps/site/app/[locale]/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Analytics } from '@vercel/analytics/react';
22
import { SpeedInsights } from '@vercel/speed-insights/next';
3-
import classNames from 'classnames';
3+
import { clsx } from 'clsx';
44
import type { FC, PropsWithChildren } from 'react';
55

66
import BaseLayout from '@/layouts/Base';
@@ -12,7 +12,7 @@ import { ThemeProvider } from '@/providers/themeProvider';
1212

1313
import '@/styles/index.css';
1414

15-
const fontClasses = classNames(IBM_PLEX_MONO.variable, OPEN_SANS.variable);
15+
const fontClasses = clsx(IBM_PLEX_MONO.variable, OPEN_SANS.variable);
1616

1717
type RotLayoutProps = PropsWithChildren<{ params: { locale: string } }>;
1818

apps/site/components/Common/ActiveLink/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import classNames from 'classnames';
3+
import { clsx } from 'clsx';
44
import type { ComponentProps, FC } from 'react';
55

66
import Link from '@/components/Link';
@@ -21,7 +21,7 @@ const ActiveLink: FC<ActiveLocalizedLinkProps> = ({
2121
}) => {
2222
const pathname = usePathname();
2323

24-
const finalClassName = classNames(className, {
24+
const finalClassName = clsx(className, {
2525
[activeClassName]: allowSubPath
2626
? // When using allowSubPath we want only to check if
2727
// the current pathname starts with the utmost upper level

apps/site/components/Common/AvatarGroup/Avatar/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as RadixAvatar from '@radix-ui/react-avatar';
2-
import classNames from 'classnames';
2+
import { clsx } from 'clsx';
33
import type { ComponentPropsWithoutRef, ElementRef } from 'react';
44
import { forwardRef } from 'react';
55

@@ -25,7 +25,7 @@ const Avatar = forwardRef<
2525
return (
2626
<RadixAvatar.Root
2727
{...props}
28-
className={classNames(styles.avatar, styles[size], props.className)}
28+
className={clsx(styles.avatar, styles[size], props.className)}
2929
ref={ref}
3030
>
3131
<Wrapper
@@ -41,7 +41,7 @@ const Avatar = forwardRef<
4141
/>
4242
<RadixAvatar.Fallback
4343
delayMs={500}
44-
className={classNames(styles.item, styles[size])}
44+
className={clsx(styles.item, styles[size])}
4545
>
4646
{fallback}
4747
</RadixAvatar.Fallback>

apps/site/components/Common/AvatarGroup/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import classNames from 'classnames';
3+
import { clsx } from 'clsx';
44
import type { FC } from 'react';
55
import { useState, useMemo, Fragment } from 'react';
66

@@ -46,7 +46,7 @@ const AvatarGroup: FC<AvatarGroupProps> = ({
4646
<Avatar
4747
{...avatar}
4848
size={size}
49-
className={classNames({
49+
className={clsx({
5050
'cursor-pointer': avatar.url,
5151
'pointer-events-none': !avatar.url,
5252
})}
@@ -57,7 +57,7 @@ const AvatarGroup: FC<AvatarGroupProps> = ({
5757
{avatars.length > limit && (
5858
<span
5959
onClick={isExpandable ? () => setShowMore(prev => !prev) : undefined}
60-
className={classNames(
60+
className={clsx(
6161
avatarstyles.avatar,
6262
avatarstyles[size],
6363
'cursor-pointer'

apps/site/components/Common/Breadcrumbs/BreadcrumbItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon';
2-
import classNames from 'classnames';
2+
import { clsx } from 'clsx';
33
import type { ComponentProps, FC, PropsWithChildren } from 'react';
44

55
import styles from './index.module.css';
@@ -24,7 +24,7 @@ const BreadcrumbItem: FC<PropsWithChildren<BreadcrumbItemProps>> = ({
2424
itemProp={!disableMicrodata ? 'itemListElement' : undefined}
2525
itemScope={!disableMicrodata ? true : undefined}
2626
itemType={!disableMicrodata ? 'https://schema.org/ListItem' : undefined}
27-
className={classNames(
27+
className={clsx(
2828
styles.item,
2929
{ [styles.visuallyHidden]: hidden },
3030
props.className

apps/site/components/Common/Breadcrumbs/BreadcrumbLink/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import classNames from 'classnames';
1+
import { clsx } from 'clsx';
22
import type { ComponentProps, FC } from 'react';
33

44
import Link from '@/components/Link';
@@ -20,11 +20,7 @@ const BreadcrumbLink: FC<BreadcrumbLinkProps> = ({
2020
itemProp="item"
2121
itemID={href?.toString()}
2222
href={href}
23-
className={classNames(
24-
styles.link,
25-
{ [styles.active]: active },
26-
props.className
27-
)}
23+
className={clsx(styles.link, { [styles.active]: active }, props.className)}
2824
aria-current={active ? 'page' : undefined}
2925
{...props}
3026
>

apps/site/components/Common/Button/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import classNames from 'classnames';
1+
import { clsx } from 'clsx';
22
import type { FC, AnchorHTMLAttributes } from 'react';
33

44
import Link from '@/components/Link';
@@ -23,7 +23,7 @@ const Button: FC<ButtonProps> = ({
2323
role="button"
2424
href={disabled ? undefined : href}
2525
aria-disabled={disabled}
26-
className={classNames(styles.button, styles[kind], className)}
26+
className={clsx(styles.button, styles[kind], className)}
2727
{...props}
2828
>
2929
{children}

apps/site/components/Common/CodeBox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
DocumentDuplicateIcon,
55
CodeBracketIcon,
66
} from '@heroicons/react/24/outline';
7-
import classNames from 'classnames';
7+
import { clsx } from 'clsx';
88
import { useTranslations } from 'next-intl';
99
import type { FC, PropsWithChildren, ReactNode } from 'react';
1010
import { Fragment, isValidElement, useRef } from 'react';
@@ -102,7 +102,7 @@ const CodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
102102
<div className={styles.root}>
103103
<pre
104104
ref={ref}
105-
className={classNames(styles.content, className)}
105+
className={clsx(styles.content, className)}
106106
tabIndex={0}
107107
dir="ltr"
108108
>

apps/site/components/Common/CrossLink/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import classNames from 'classnames';
1+
import { clsx } from 'clsx';
22
import { useTranslations } from 'next-intl';
33
import type { FC } from 'react';
44

@@ -20,7 +20,7 @@ const CrossLink: FC<CrossLinkProps> = ({ type, text, link }) => {
2020
return (
2121
<Link className={styles.crossLink} href={link}>
2222
<span
23-
className={classNames(styles.header, {
23+
className={clsx(styles.header, {
2424
[styles.reverse]: type === 'next',
2525
})}
2626
>
@@ -29,7 +29,7 @@ const CrossLink: FC<CrossLinkProps> = ({ type, text, link }) => {
2929
</span>
3030

3131
<span
32-
className={classNames(styles.content, {
32+
className={clsx(styles.content, {
3333
[styles.reverse]: type === 'next',
3434
})}
3535
>

apps/site/components/Common/LanguageDropDown/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LanguageIcon } from '@heroicons/react/24/outline';
22
import type { LocaleConfig } from '@node-core/website-i18n/types';
33
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
4-
import classNames from 'classnames';
4+
import { clsx } from 'clsx';
55
import { useTranslations } from 'next-intl';
66
import type { FC } from 'react';
77

@@ -43,7 +43,7 @@ const LanguageDropdown: FC<LanguageDropDownProps> = ({
4343
<DropdownMenu.Item
4444
key={code}
4545
onClick={() => onChange({ name, code })}
46-
className={classNames(styles.dropDownItem, {
46+
className={clsx(styles.dropDownItem, {
4747
[styles.currentDropDown]: code === currentLanguage,
4848
})}
4949
>

0 commit comments

Comments
 (0)