diff --git a/src/blocks/Icons/Icons.tsx b/src/blocks/Icons/Icons.tsx index 43ed83be2..1479e8f0e 100644 --- a/src/blocks/Icons/Icons.tsx +++ b/src/blocks/Icons/Icons.tsx @@ -1,8 +1,9 @@ -import React, {Fragment, useContext} from 'react'; +import React, {Fragment, useCallback, useContext} from 'react'; import {Image, Title} from '../../components'; import {LocationContext} from '../../context/locationContext'; -import {IconsBlockProps} from '../../models'; +import {useAnalytics} from '../../hooks'; +import {DefaultEventNames, IconsBlockProps} from '../../models'; import {block, getLinkProps} from '../../utils'; import './Icons.scss'; @@ -16,8 +17,12 @@ const getItemContent = (item: IconsBlockProps['items'][number]) => ( ); -const Icons = ({title, size = 's', items}: IconsBlockProps) => { +const Icons = ({title, size = 's', items, analyticsEvents, url: analyticsUrl}: IconsBlockProps) => { const {hostname} = useContext(LocationContext); + const handleAnalytics = useAnalytics(DefaultEventNames.Link, analyticsUrl); + const onClick = useCallback(() => { + handleAnalytics(analyticsEvents); + }, [handleAnalytics, analyticsEvents]); return (