Skip to content

Commit

Permalink
[icons] Reduce Material Icon page size (#43911)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Sep 30, 2024
1 parent 2ea7cf6 commit 955f109
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions docs/data/material/components/material-icons/SearchIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,15 @@ const StyledSvgIcon = styled(SvgIcon)(({ theme }) => ({
},
}));

const handleIconClick = (event) => {
const { iconName, iconTheme } = event.currentTarget.dataset;

if (Math.random() < 0.1) {
window.gtag('event', 'material-icons', {
eventAction: 'click',
eventLabel: iconName,
});
window.gtag('event', 'material-icons-theme', {
eventAction: 'click',
eventLabel: iconTheme,
});
}
const handleIconClick = (icon) => () => {
window.gtag('event', 'material-icons', {
eventAction: 'click',
eventLabel: icon.name,
});
window.gtag('event', 'material-icons-theme', {
eventAction: 'click',
eventLabel: icon.theme,
});
};

function handleLabelClick(event) {
Expand All @@ -153,9 +149,7 @@ function Icon(props) {
return (
<StyledIcon
key={icon.importName}
onClick={handleIconClick}
data-icon-theme={icon.theme}
data-icon-name={icon.name}
onClick={Math.random() < 0.1 ? handleIconClick(icon) : null}
>
<StyledSvgIcon
component={icon.Component}
Expand Down

0 comments on commit 955f109

Please sign in to comment.