Skip to content

Commit

Permalink
Merge pull request #320 from Studio-Yandex-Practicum/enhancement_307_…
Browse files Browse the repository at this point in the history
…fix_routing_at_header_icon

enhancement_307_fix_routing_at_header_icon
  • Loading branch information
AlexanderMorugin authored Apr 19, 2024
2 parents d2b2831 + cedc590 commit 8ff0f59
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 26 deletions.
11 changes: 4 additions & 7 deletions src/shared/ui/logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import { type FC } from 'react'

import { Routes } from '@/shared/config/routerConfig/routes'
import Link from '@/shared/ui/Link/Link'

import styles from './logo.module.scss'

type TLogoProps = {
image: string
title: string
url: string
width: string
height: string
}
/**
* @param {string} image - путь к логотипу на сервере
* @param {string} title - лейбл логотипа (и альт)
* @param {string} url - путь ссылки по нажатию на логотип
* @param {string} width - ширина логотипа
* @param {string} height - высота логотипа
*/

const Logo: FC<TLogoProps> = ({ image, title, url, width, height }) => {
const Logo: FC<TLogoProps> = ({ image, width, height }) => {
return (
<div className={styles.container}>
<Link to={url} className={styles.link}>
<img src={image} title={title} alt={title} style={{ width, height }} />
<Link to={Routes.HOME} className={styles.link}>
<img src={image} alt="Logo" style={{ width, height }} />
</Link>
</div>
)
Expand Down
8 changes: 1 addition & 7 deletions src/widgets/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ function Footer() {
<div className={styles.footer__container}>
<div className={styles.footer__middle}>
<div className={styles['footer__col-one']}>
<Logo
image={coreBaseData.footer.main_logo.image}
title={coreBaseData.footer.main_logo.title}
url={coreBaseData.footer.main_logo.url}
width="114px"
height="38px"
/>
<Logo image={coreBaseData.footer.main_logo.image} width="114px" height="38px" />
<Paragraph className={styles.footer__caption}>{coreBaseData.footer.company_info}</Paragraph>
</div>
<div className={styles['footer__col-two']}>
Expand Down
8 changes: 1 addition & 7 deletions src/widgets/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,7 @@ function Header() {
</div>

<div className={styles['header__row-two']}>
<Logo
image={coreBaseData.header.main_logo.image}
title={coreBaseData.header.main_logo.title}
url={coreBaseData.header.main_logo.url}
width="138px"
height="46px"
/>
<Logo image={coreBaseData.header.main_logo.image} width="138px" height="46px" />
<SearchProduct />
<HeaderAccount {...headerAccountData} />
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/widgets/Header/model/slice/headerSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const initialState: CoreBaseHeaderSchema = {
isLoading: false,
header: {
main_logo: {
image: '',
url: '',
title: ''
image: ''
},
support: {
callback: '',
Expand Down
2 changes: 0 additions & 2 deletions src/widgets/Header/model/types/types.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
interface Logo {
image: string
url: string
title: string
}

interface Support {
Expand Down

0 comments on commit 8ff0f59

Please sign in to comment.