From a5df28fad0dae266a857ae110c43b3cb8b23c996 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 8 Apr 2022 19:41:40 +0200 Subject: refactor: use a consistent classname prop and avoid children prop I was using the FunctionComponent type for some component that do not use children. So I change the type to VoidFunctionComponent to avoid mistakes. I also rename all the "classes" or "additionalClasses" props to "className" to keep consistency between each components. --- src/components/atoms/links/link.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/components/atoms/links/link.tsx') diff --git a/src/components/atoms/links/link.tsx b/src/components/atoms/links/link.tsx index a61158f..87f11fc 100644 --- a/src/components/atoms/links/link.tsx +++ b/src/components/atoms/links/link.tsx @@ -2,11 +2,11 @@ import NextLink from 'next/link'; import { FC } from 'react'; import styles from './link.module.scss'; -type LinkProps = { +export type LinkProps = { /** - * Set additional classes to the link. + * Set additional classnames to the link. */ - classes?: string; + className?: string; /** * True if it is an external link. Default: false. */ @@ -28,24 +28,22 @@ type LinkProps = { */ const Link: FC = ({ children, - classes, + className = '', href, lang, external = false, }) => { - const additionalClasses = classes || ''; - return external ? ( {children} ) : ( - {children} + {children} ); }; -- cgit v1.2.3