0.1.1 • Published 7 months ago
@graffiti-garden/modal v0.1.1
Graffiti Modal
A styling modal for user input within Graffiti implementations. Used for login popups and choosing servers. For example, see the Solid session manager
Usage
Install the package with:
npm install @graffiti-garden/modalThen use it in your application as follows:
import { GraffitiModal } from "@graffiti-garden/modal";
const modal = new GraffitiModal({
useTemplateHTML: import("./templates.html").then((module) => module.default),
onClose() {
console.log("Modal closed");
},
});
button.addEventListener("click", () => {
modal.displayTemplate("my-template"); // The id of a template in the HTML
modal.open();
});See the demo for a full example.
Development
Clone the repository, then install and build the package as follows:
npm install
npm run buildThen you can run the demo by running:
npx http-serverand navigating to localhost:8080/demo.
Image Compression
To make the .jpg image smaller, use:
cwebp -q QUALITY -m 6 -mt graffiti.jpg -o graffiti.webpWhere quality is a number between 0 (horrible) and 100 (perfect).