feat: add deep link theme installation support

This commit is contained in:
Hachi-R
2025-02-15 22:18:42 -03:00
parent ec638d1a7a
commit 740d3ffaac
5 changed files with 67 additions and 7 deletions

View File

@@ -61,13 +61,20 @@ export const injectCustomCss = (css: string) => {
currentCustomCss.remove();
}
const style = document.createElement("style");
style.id = "custom-css";
style.textContent = `
${css}
`;
document.head.appendChild(style);
if (css.startsWith("https://hydrathemes.shop/")) {
const link = document.createElement("link");
link.id = "custom-css";
link.rel = "stylesheet";
link.href = css;
document.head.appendChild(link);
} else {
const style = document.createElement("style");
style.id = "custom-css";
style.textContent = `
${css}
`;
document.head.appendChild(style);
}
} catch (error) {
console.error("failed to inject custom css:", error);
}

View File

@@ -85,6 +85,10 @@
flex-direction: row;
gap: 8px;
&--external {
display: none;
}
Button {
padding: 8px 11px;
}

View File

@@ -111,6 +111,7 @@ export const ThemeCard = ({ theme, onListUpdated }: ThemeCardProps) => {
<div className="theme-card__actions__right">
<Button
className={theme.code.startsWith("https://hydrathemes.shop/") ? "theme-card__actions__right--external" : ""}
onClick={() => window.electron.openEditorWindow(theme.id)}
title={t("edit_theme")}
theme="outline"