refactor: replace classnames with class:list

This commit is contained in:
Stefan Imhoff
2024-09-11 13:21:11 +02:00
parent 526fe22cda
commit c9461b356d
48 changed files with 535 additions and 538 deletions

View File

@@ -1,7 +1,5 @@
---
// Cspell:words astro classnames noopener noreferrer
import cx from 'classnames';
// Cspell:words astro noopener noreferrer
interface Props {
class?: string;
href?: string;
@@ -11,11 +9,10 @@ interface Props {
const { class: className, href = '#', ...props } = Astro.props;
const isExternal = (href as string).startsWith('http');
const classes = cx('link', { external: isExternal }, className);
---
<a
class={classes}
class:list={['link', { external: isExternal }, className]}
href={href}
rel={isExternal ? 'nofollow noopener noreferrer' : undefined}
target={isExternal ? '_blank' : undefined}