mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-31 00:34:05 -06:00
Check null cases
This commit is contained in:
parent
15370625a6
commit
65052b865d
@ -26,10 +26,8 @@ const getThemeName = (theme: "light" | "dark") => {
|
|||||||
if (!giscusContainer) {
|
if (!giscusContainer) {
|
||||||
return theme
|
return theme
|
||||||
}
|
}
|
||||||
const darkGiscus =
|
const darkGiscus = giscusContainer.dataset.darkTheme ?? "dark"
|
||||||
giscusContainer.dataset.darkTheme !== "" ? giscusContainer.dataset.darkTheme : "dark"
|
const lightGiscus = giscusContainer.dataset.lightTheme ?? "light"
|
||||||
const lightGiscus =
|
|
||||||
giscusContainer.dataset.lightTheme !== "" ? giscusContainer.dataset.lightTheme : "light"
|
|
||||||
return theme === "dark" ? darkGiscus : lightGiscus
|
return theme === "dark" ? darkGiscus : lightGiscus
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,9 +36,7 @@ const getThemeUrl = () => {
|
|||||||
if (!giscusContainer) {
|
if (!giscusContainer) {
|
||||||
return "https://giscus.app"
|
return "https://giscus.app"
|
||||||
}
|
}
|
||||||
return giscusContainer.dataset.themeUrl !== ""
|
return giscusContainer.dataset.themeUrl ?? "https://giscus.app"
|
||||||
? giscusContainer.dataset.themeUrl
|
|
||||||
: "https://giscus.app"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GiscusElement = Omit<HTMLElement, "dataset"> & {
|
type GiscusElement = Omit<HTMLElement, "dataset"> & {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user