Skip to content

Commit

Permalink
Merge pull request #566 from Studio-Yandex-Practicum/feature/issue-55…
Browse files Browse the repository at this point in the history
…7/donation-rout-active-style

Feature/issue 557/donation rout active style
  • Loading branch information
AntonZelinsky authored Sep 8, 2024
2 parents 1a21723 + 8ecfd77 commit ab74c38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/donation-link/donation-link.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
border-top-right-radius: 200% 100%;
}

&:hover {
&:hover,
&.active {
&::before,
&::after {
visibility: visible;
Expand Down
5 changes: 4 additions & 1 deletion src/components/donation-link/donation-link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cn from 'classnames/bind';
import Link from 'next/link';
import { useRouter } from 'next/router';

import { Icon } from 'components/ui/icon';

Expand All @@ -11,10 +12,12 @@ const cx = cn.bind(styles);

export const DonationLink = (props: Pick<LinkProps, 'href'>): JSX.Element => {
const { href } = props;
const router = useRouter();
const isActive = router.asPath === href;

return (
<Link href={href}>
<a className={cx('link')}>
<a className={cx('link', { active: isActive })}>
<Icon glyph="plus" className={cx('icon')}/>
<span className={cx('text')}>
Поддержать
Expand Down

0 comments on commit ab74c38

Please sign in to comment.