Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[icons][docs] Reduce Material Icon page size #43911

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading