2import { serveFile } from "../index.ts";
3
4export function staticHTTPServer(importMetaURL: string) {
5 const app = new Hono();
6 app.get("/", () => serveFile("/index.html", importMetaURL));
18}
19// Simple hook for mobile menu toggle
20function useMobileMenu() {
21 const [isOpen, setIsOpen] = useState(false);
22 const toggleMenu = () => setIsOpen(!isOpen);
26
27// Simple hook for tracking current hash for active nav styling
28function useCurrentHash() {
29 const [currentHash, setCurrentHash] = useState(() =>
30 window.location.hash.slice(1)
43}
44
45export function App({ initialData }: AppProps) {
46 // initialData
47 const { demoData, loading, error } = initialData;
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function CheckoutContent({ data, content }) {
5 // const { content, contentURL, docsURL } = config;
6 // console.log("content: ", content);
6});
7
8export async function getRelatedPagesFromDatabase(
9 pageId: string // the /demo page
10) {
2import type { ReactNode } from "npm:react@18.2.0";
3
4export function Layout({ children }: { children: ReactNode }) {
5 return (
6 <html lang="en">
5import { Layout } from "./Layout.tsx";
6
7function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
8 return (
9 <div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
14}
15
16export default async function(req: Request): Promise<Response> {
17 const url = new URL(req.url);
18 if (url.pathname === "/") {
44}
45
46function html(children: React.ReactNode) {
47 return new Response(
48 renderToString(
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
1import { blob } from "https://esm.town/v/std/blob";
2
3async function getRoom(roomName: string) {
4 try {
5 return await blob.getJSON(`room_${roomName}.json`);
9}
10
11async function saveRoom(roomName: string, data: any) {
12 await blob.setJSON(`room_${roomName}.json`, data);
13}
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function FormContent({ data, content }) {
5 // const { content, contentURL, docsURL } = config;
6 // console.log("content: ", content);
29 <h2>Cobrowse & mask fields on forms</h2>
30 <p>
31 Glance cobrowse provides a “hook” function to allow customers to
32 customize page and element masking during a cobrowse session.
33 </p>
1export default function handler(req: Request): Response {
2 const html = `<!DOCTYPE html>
3 <html lang="en">
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.