@@ -13,8 +13,10 @@ import {
1313} from '../../../../models/navigation' ;
1414import { NavigationArrow } from '../../../../icons' ;
1515import SocialIcon from '../SocialIcon/SocialIcon' ;
16+ import { getMediaImage } from '../../../Media/Image/utils' ;
1617
1718import './NavigationItem.scss' ;
19+ import { ImageProps } from '../../../../models' ;
1820
1921const b = block ( 'navigation-item' ) ;
2022
@@ -33,9 +35,9 @@ export interface NavigationItemProps {
3335 isOpened ?: boolean ;
3436}
3537
36- const Content : React . FC < { text : string ; icon ?: string } > = ( { text, icon} ) => (
38+ const Content : React . FC < { text : string ; icon ?: ImageProps } > = ( { text, icon} ) => (
3739 < Fragment >
38- { icon && < img className = { b ( 'icon' ) } src = { icon } /> }
40+ { icon && < img className = { b ( 'icon' ) } { ... icon } /> }
3941 < span className = { b ( 'text' ) } > { text } </ span >
4042 </ Fragment >
4143) ;
@@ -47,29 +49,34 @@ const NavigationDropdown: React.FC<NavigationDropdownProps> = ({
4749 icon,
4850 isOpened,
4951 ...props
50- } ) => (
51- < span { ...props } >
52- < Content text = { text } icon = { icon } />
53- < ToggleArrow
54- className = { b ( 'dropdown' ) }
55- size = { 12 }
56- type = { 'vertical' }
57- iconType = "navigation"
58- open = { isOpened }
59- />
60- </ span >
61- ) ;
52+ } ) => {
53+ const iconData = icon && getMediaImage ( icon ) ;
54+
55+ return (
56+ < span { ...props } >
57+ < Content text = { text } icon = { iconData } />
58+ < ToggleArrow
59+ className = { b ( 'dropdown' ) }
60+ size = { 12 }
61+ type = { 'vertical' }
62+ iconType = "navigation"
63+ open = { isOpened }
64+ />
65+ </ span >
66+ ) ;
67+ } ;
6268
6369type NavigationLinkProps = NavigationItemProps & NavigationLinkItem ;
6470
6571const NavigationLink : React . FC < NavigationLinkProps > = ( props ) => {
6672 const { hostname} = useContext ( LocationContext ) ;
6773 const { url, text, icon, arrow, target, ...rest } = props ;
6874 const linkExtraProps = getLinkProps ( url , hostname , target ) ;
75+ const iconData = icon && getMediaImage ( icon ) ;
6976
7077 const content = (
7178 < Fragment >
72- < Content text = { text } icon = { icon } />
79+ < Content text = { text } icon = { iconData } />
7380 { arrow && < NavigationArrow className = { b ( 'arrow' ) } /> }
7481 </ Fragment >
7582 ) ;
0 commit comments