65 lines
1.8 KiB
HTML
65 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link href="/favicon.ico" rel="icon" />
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
<title>@halo-dev/comment-widget - example</title>
|
|
<script src="/src/main.ts" type="module"></script>
|
|
|
|
<style>
|
|
#toggle-theme {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
:root {
|
|
--halo-cw-base-rounded: 0.5em;
|
|
--halo-cw-avatar-rounded: 1px;
|
|
--halo-cw-avatar-size: 2em;
|
|
--halo-cw-base-font-family: 'Inter', sans-serif;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
const button = document.getElementById("toggle-theme");
|
|
button.addEventListener("click", () => {
|
|
document.documentElement.classList.toggle("dark");
|
|
// save the theme to local storage
|
|
localStorage.setItem(
|
|
"theme",
|
|
document.documentElement.classList.contains("dark")
|
|
? "dark"
|
|
: "light"
|
|
);
|
|
});
|
|
|
|
// get the theme from local storage
|
|
const theme = localStorage.getItem("theme");
|
|
if (theme) {
|
|
document.documentElement.classList.add(theme);
|
|
}
|
|
});
|
|
|
|
window.addEventListener("halo:comment:created", () => {
|
|
console.log("halo:comment:created");
|
|
});
|
|
|
|
window.addEventListener("halo:comment-reply:created", () => {
|
|
console.log("halo:comment-reply:created");
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<button id="toggle-theme">Dark / Light</button>
|
|
<comment-widget
|
|
baseUrl="http://127.0.0.1:8090"
|
|
group="content.halo.run"
|
|
kind="Post"
|
|
version="v1alpha1"
|
|
name="5152aea5-c2e8-4717-8bba-2263d46e19d5"
|
|
with-replies="false"
|
|
></comment-widget>
|
|
</body>
|
|
</html>
|