/
dedaMazai
/
reactGoodPattern
Обзор
Документация
Войти
/
dedaMazai
/
reactGoodPattern
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/shared/ui/AppLink/AppLink.tsx
33 строки
783 B
Andrei Chipizubov
fix
23 май 2023, 18:18
23 май 2023, 18:18
e1aefbb
Код
Авторство
О чём код?
import { memo, ReactNode } from 'react'; import { Link, LinkProps } from 'react-router-dom'; import { classNames } from '@/shared/lib/classNames/classNames'; import cls from './AppLink.module.scss'; interface AppLinkProps extends LinkProps { className?: string; theme?: 'primary' | 'secondary'; children?: ReactNode; hovered?: boolean; } export const AppLink = memo((props: AppLinkProps) => { const { to, className, children, hovered, theme = 'primary', ...otherProps } = props; return ( <Link to={to} className={classNames(cls.AppLink, { [cls.hovered]: hovered }, [className, cls[theme]])} {...otherProps} > {children} </Link> ); });