so this is my first time creating a module, and now i want to call it in app.tsx, and it just saying this error:
error: Module not found "https://deno.land/x/bravo_six@v1.0.5-alpha/bravo_six".
at https://deno.land/x/bravo_six@v1.0.5-alpha/mod.ts:1:27
at <anonymous> (file:///home/runner/deno/index.tsx:2:8)
app.tsx
import React, { useState } from "https://esm.sh/react@17.0.2";
import { Bravo_Six as BravoSix } from "https://deno.land/x/bravo_six@v1.0.5-alpha/mod.ts";
export default function App() {
const [colorTheme, setColorTheme] = useState("original");
const bravoSix = new BravoSix(document.body);
const handleButtonClick = () => {
console.log("Current color theme:", colorTheme);
let newTheme;
switch (colorTheme) {
case "original":
newTheme = "dark";
break;
case "dark":
newTheme = "light";
break;
case "light":
newTheme = "night-vision";
break;
case "night-vision":
newTheme = "original";
break;
default:
newTheme = "original";
}
setColorTheme(newTheme);
bravoSix.applyColors(newTheme);
};
return (
<div className="App">
<header className="App-header">
<h1>Klik tombol di bawah untuk mengganti tema warna:</h1>
<button onClick={handleButtonClick}>Ganti Tema Warna</button>
</header>
</div>
);
}
im feeling its my module that broken, can you help me? here's inside my module
bravo_six.ts
class Bravo_Six {
private targetElement: HTMLElement;
constructor(targetElement?: HTMLElement) {
this.targetElement = targetElement || document.body;
}
getOriginalStyles(): { backgroundColor: string; color: string } {
return {
backgroundColor: this.targetElement.style.backgroundColor,
color: this.targetElement.style.color,
};
}
applyColors(colorTheme: string): void {
console.log("Applying color theme:", colorTheme);
let backgroundColor, textColor;
switch (colorTheme) {
case "original":
backgroundColor = ""; // Kosongkan nilai untuk kembali ke nilai CSS awal
textColor = "";
break;
case "dark":
backgroundColor = "black";
textColor = "white";
break;
case "light":
backgroundColor = "white";
textColor = "black";
break;
case "night-vision":
backgroundColor = "#367978";
textColor = "white";
break;
default:
console.error("Invalid color theme");
return;
}
this.targetElement.style.backgroundColor = backgroundColor;
this.targetElement.style.color = textColor;
}
}
export { Bravo_Six };
mod.ts
import { Bravo_Six } from "./bravo_six";
export default Bravo_Six;
this is the link to my module if you wanna see https://deno.land/x/bravo_six@v1.0.5-alpha
I would be very grateful if you could help me. Thanks! 😄