🎨 refactor: format JS with Prettier (#240)

This commit is contained in:
Óscar
2024-01-03 01:44:31 +01:00
committed by GitHub
parent 39fc4ece61
commit b6a89e6370
12 changed files with 93 additions and 62 deletions

View File

@@ -1,6 +1,6 @@
function setUtterancesTheme(newTheme) {
// Get the frame with class "utterances-frame".
const frame = document.querySelector(".utterances-frame");
const frame = document.querySelector('.utterances-frame');
if (frame) {
// If the iframe exists, send a message to set the theme.
@@ -34,7 +34,8 @@ function initUtterances() {
script.setAttribute('label', label);
// Set the initial theme.
const currentTheme = document.documentElement.getAttribute('data-theme') || 'light';
const currentTheme =
document.documentElement.getAttribute('data-theme') || 'light';
const selectedTheme = currentTheme === 'dark' ? darkTheme : lightTheme;
script.setAttribute('theme', selectedTheme);
@@ -51,7 +52,8 @@ function initUtterances() {
// Listen for themeChanged event to update the theme.
window.addEventListener('themeChanged', (event) => {
// Determine the new theme based on the event detail.
const selectedTheme = event.detail.theme === 'dark' ? darkTheme : lightTheme;
const selectedTheme =
event.detail.theme === 'dark' ? darkTheme : lightTheme;
// Set the new theme.
setUtterancesTheme(selectedTheme);
});