-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature/EPMGCIP-164/Implement feature * feature/EPMGCIP-164/Added tests * feature/EPMGCIP-164/Added routes label enum and updated 'Contacts' route * feature/EPMGCIP-164/Added translation * feature/EPMGCIP-164/Components converted to arrow functions * feature/EPMGCIP-164/Add new unit test --------- Co-authored-by: Siarhei Balonikau <[email protected]>
- Loading branch information
Showing
15 changed files
with
206 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@use 'sass:map'; | ||
@import '../../../variables.scss'; | ||
|
||
.link { | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 32px; | ||
height: 32px; | ||
background-color: $circleLinkBackgroundColor; | ||
border-radius: 50%; | ||
transition: background-color 0.1s; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
background-color: $colorLink; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { IconBrandTelegram } from '@tabler/icons-react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import { CircleLink } from './CircleLink'; | ||
|
||
describe('CircleLink', () => { | ||
it('renders the CircleLink component with an icon and a link', () => { | ||
const link = 'https://test.com'; | ||
const icon = <IconBrandTelegram color="white" size="20" data-testid="icon" />; | ||
|
||
render(<CircleLink link={link} icon={icon} />); | ||
|
||
const circleLinkElement = screen.getByRole('link'); | ||
|
||
expect(circleLinkElement).toBeInTheDocument(); | ||
expect(circleLinkElement).toHaveAttribute('href', link); | ||
expect(circleLinkElement).toContainElement(screen.getByTestId('icon')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styles from './CircleLink.module.scss'; | ||
|
||
interface Props { | ||
link: string; | ||
icon: JSX.Element; | ||
} | ||
|
||
export const CircleLink = ({ link, icon }: Props) => { | ||
return ( | ||
<a href={link} className={styles.link}> | ||
{icon} | ||
</a> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@use 'sass:map'; | ||
@import '../../../variables.scss'; | ||
|
||
.footer { | ||
padding: 40px 16px; | ||
background-color: $secondaryBackgroundColor; | ||
text-align: center; | ||
} | ||
|
||
.socialLinks { | ||
display: flex; | ||
justify-content: center; | ||
gap: 24px; | ||
padding-bottom: 40px; | ||
} | ||
|
||
.copyright { | ||
max-width: 530px; | ||
margin: 0 auto; | ||
font-size: $fontSizeDefault; | ||
font-weight: 500; | ||
} | ||
|
||
.contactsLink { | ||
color: $mainFontColor; | ||
text-decoration: underline; | ||
|
||
&:hover { | ||
text-decoration: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MantineProvider } from '@mantine/core'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { NextIntlClientProvider } from 'next-intl'; | ||
|
||
import messages from 'messages/en.json'; | ||
|
||
import { Footer } from './Footer'; | ||
|
||
const wrapper = ({ children }: { children: React.ReactNode }) => ( | ||
<NextIntlClientProvider locale="en" messages={messages}> | ||
<MantineProvider>{children}</MantineProvider> | ||
</NextIntlClientProvider> | ||
); | ||
|
||
describe('Footer', () => { | ||
it('renders correctly and show copyrights', () => { | ||
const { getByText } = render(<Footer />, { wrapper }); | ||
|
||
expect(getByText(new RegExp('All copyrights reserved', 'i'))).toBeInTheDocument(); | ||
expect(getByText(new RegExp('Contact details', 'i'))).toBeInTheDocument(); | ||
}); | ||
|
||
it('has social network links', () => { | ||
render(<Footer />, { wrapper }); | ||
|
||
const socialNetworkLinks = 4; | ||
expect(screen.getAllByTestId('social-network').length).toBe(socialNetworkLinks); | ||
}); | ||
|
||
it('show current year', () => { | ||
render(<Footer />, { wrapper }); | ||
|
||
const currentYear = new Date().getFullYear(); | ||
expect(screen.getByText(new RegExp(currentYear.toString(), 'i'))).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
IconBrandTelegram, | ||
IconBrandFacebook, | ||
IconBrandInstagram, | ||
IconBrandYoutube, | ||
} from '@tabler/icons-react'; | ||
import Link from 'next/link'; | ||
import { useTranslations } from 'next-intl'; | ||
|
||
import { CircleLink } from '@/components/atoms/CircleLink/CircleLink'; | ||
import { APP_ROUTES } from '@/constants/routes'; | ||
import { RouteLabelsEnum } from '@/enums'; | ||
|
||
import styles from './Footer.module.scss'; | ||
|
||
export const Footer = () => { | ||
const t = useTranslations(); | ||
const currentYear = new Date().getFullYear(); | ||
const contactRoute = APP_ROUTES.find((r) => r.label === RouteLabelsEnum.Contacts); | ||
|
||
return ( | ||
<div className={styles.footer}> | ||
<div className={styles.socialLinks}> | ||
<CircleLink | ||
link="https://www.facebook.com/savitskymuseum/" | ||
icon={<IconBrandTelegram color="white" size="20" data-testid="social-network" />} | ||
/> | ||
<CircleLink | ||
link="https://www.instagram.com/museumsavitsky1/" | ||
icon={<IconBrandInstagram color="white" size="20" data-testid="social-network" />} | ||
/> | ||
<CircleLink | ||
link="https://t.me/museumsavitsky" | ||
icon={<IconBrandFacebook color="white" size="20" data-testid="social-network" />} | ||
/> | ||
<CircleLink | ||
link="https://www.youtube.com/channel/UCshZAh9gVGMv_gFQJo3IXyQ" | ||
icon={<IconBrandYoutube color="white" size="19" data-testid="social-network" />} | ||
/> | ||
</div> | ||
<div className={styles.copyright}> | ||
©{currentYear}. {t('copyright.message')}{' '} | ||
{contactRoute?.url && ( | ||
<Link className={styles.contactsLink} href={contactRoute.url}> | ||
{t('copyright.contact')} | ||
</Link> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export enum RouteLabelsEnum { | ||
Home = 'Home', | ||
Museum = 'Museum', | ||
Exposition = 'Exposition', | ||
News = 'News', | ||
Contacts = 'Contacts', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { NotificationType } from './app-notifications'; | ||
export { ContactFormValidationErrors } from './validation-errors'; | ||
export { RouteLabelsEnum } from './RouteLabelsEnum'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters