Skip to content

fix: markup in banners #243

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

Merged
merged 5 commits into from
Mar 8, 2025
Merged
Changes from 2 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
19 changes: 9 additions & 10 deletions content-scripts/modules/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,15 @@ const replaceBgImages = (): void => {
const replaceBanners = (): void => {
Object.entries(BANNER_ICON_MAP).forEach(([k, v]) => {
document.querySelectorAll(`.${k}`).forEach((i) => {
const span = <span>{i.textContent}</span>;

// TODO (thePeras): Use <Icon />, but you need to expand the Icon component to support fill and style
const icon = (
<span
className={`se-icon ri-${v}-fill`}
style={{ fontSize: "1.5em" }}
/>
);
i.replaceChildren(icon, span);
const icon = document.createElement("span");
icon.className = `se-icon ri-${v}-fill`;
icon.style.fontSize = "1.5em";

const wrapper = document.createElement("span");
while (i.firstChild) {
wrapper.appendChild(i.firstChild);
}
i.replaceChildren(icon, wrapper);
});
});
};
Expand Down