Replace classnames package with clsx

This commit is contained in:
Alejandro Celaya
2023-11-01 09:41:21 +01:00
parent 060dcc8500
commit 98b2db99b3
8 changed files with 27 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useToggle } from '@shlinkio/shlink-frontend-kit';
import classNames from 'classnames';
import { clsx } from 'clsx';
import type { FC, PropsWithChildren } from 'react';
import type { FCWithDeps } from '../container/utils';
import { componentFactory, useDependencies } from '../container/utils';
@@ -26,7 +26,7 @@ const DeleteServerButton: FCWithDeps<DeleteServerButtonProps, DeleteServerButton
return (
<>
<button type="button" className={classNames(className, 'p-0 bg-transparent border-0')} onClick={showModal}>
<button type="button" className={clsx(className, 'p-0 bg-transparent border-0')} onClick={showModal}>
{!children && <FontAwesomeIcon fixedWidth icon={deleteIcon} />}
<span className={textClassName}>{children ?? 'Remove this server'}</span>
</button>

View File

@@ -1,6 +1,6 @@
import { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
import { clsx } from 'clsx';
import type { FC, PropsWithChildren } from 'react';
import { Link } from 'react-router-dom';
import { ListGroup, ListGroupItem } from 'reactstrap';
@@ -26,7 +26,7 @@ export const ServersListGroup: FC<ServersListGroupProps> = ({ servers, children,
<ListGroup
data-testid="list"
tag="div"
className={classNames('servers-list__list-group', { 'servers-list__list-group--embedded': embedded })}
className={clsx('servers-list__list-group', { 'servers-list__list-group--embedded': embedded })}
>
{servers.map(({ id, name }) => <ServerListItem key={id} id={id} name={name} />)}
</ListGroup>