diff --git a/.vscode/import_map.json b/.vscode/import_map.json index 1cb407c1..8952e50a 100644 --- a/.vscode/import_map.json +++ b/.vscode/import_map.json @@ -17,8 +17,6 @@ "$std/": "https://deno.land/std@0.216.0/", "$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts", "$marked-mangle": "https://esm.sh/marked-mangle@1.0.1", - "$fresh-testing-library": "https://deno.land/x/fresh_testing_library@0.11.1/mod.ts", - "$fresh-testing-library/": "https://deno.land/x/fresh_testing_library@0.11.1/", "tailwindcss": "npm:tailwindcss@3.4.1", "tailwindcss/": "npm:/tailwindcss@3.4.1/", "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js" diff --git a/tests/www/components/gallery/Background.test.tsx b/tests/www/components/gallery/Background.test.tsx deleted file mode 100644 index a0c9e884..00000000 --- a/tests/www/components/gallery/Background.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { assertEquals } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Background from "$fresh/www/components/gallery/Background.tsx"; - -describe("components/gallery/Background.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should display background image", () => { - const { getByTitle } = render(); - const bg = getByTitle("background"); - const style = bg.getAttribute("style"); - assertEquals(style, "background-image: url(/gallery/grid.svg);"); - }); -}); diff --git a/tests/www/components/gallery/Button.test.tsx b/tests/www/components/gallery/Button.test.tsx deleted file mode 100644 index 537db63f..00000000 --- a/tests/www/components/gallery/Button.test.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { assertEquals, assertExists } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Button from "../../../../www/components/gallery/Button.tsx"; - -describe("components/gallery/LinkButton.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should show button", () => { - const { getByRole } = render( - , - ); - const button = getByRole("button"); - assertExists(button); - assertEquals((button as HTMLButtonElement).value, "Click Me!"); - }); -}); diff --git a/tests/www/components/gallery/Carousel.test.tsx b/tests/www/components/gallery/Carousel.test.tsx deleted file mode 100644 index 3637fcf0..00000000 --- a/tests/www/components/gallery/Carousel.test.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { assertEquals } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Carousel from "../../../../www/components/gallery/Carousel.tsx"; - -describe("Carousel.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should display navigation buttons", () => { - const { getAllByRole } = render( - , - ); - const buttons = getAllByRole("button"); - assertEquals(buttons.length, 6); - }); -}); diff --git a/tests/www/components/gallery/CodeBox.test.tsx b/tests/www/components/gallery/CodeBox.test.tsx deleted file mode 100644 index 057bd8e4..00000000 --- a/tests/www/components/gallery/CodeBox.test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { assert } from "$std/testing/asserts.ts"; -import { cleanup, fireEvent, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import CodeBox from "$fresh/www/components/gallery/CodeBox.tsx"; - -describe("components/gallery/LinkButton.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should show Copy button", async () => { - const code = "console.log('Hello World')"; - const { getByText, getByRole, findByText } = render( - , - ); - // summary - assert(getByText("Code")); - // button text - assert(getByText("Copy")); - const button = getByRole("button"); - // click button, button text should change to "Copied!" - fireEvent.click(button); - const copied = await findByText("Copied!"); - assert(copied); - }); - - it("should show source code", () => { - const code = "console.log('Hello World')"; - const { getByText, getByRole } = render(); - // find code - const codeElement = getByRole("code"); - const content = codeElement.textContent; - // Prism library breaks up code for styling purposes - assert( - getByText((content) => content.includes("console")), - ); - assert( - getByText((content) => content.includes("log")), - ); - assert( - getByText((content) => content.includes("Hello World")), - ); - }); -}); diff --git a/tests/www/components/gallery/ColoredButton.test.tsx b/tests/www/components/gallery/ColoredButton.test.tsx deleted file mode 100644 index 49cef825..00000000 --- a/tests/www/components/gallery/ColoredButton.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { assert } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import ColoredButton from "$fresh/www/components/gallery/ColoredButton.tsx"; - -describe("components/gallery/ColoredButton.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should have disabled set to false", () => { - const { getByTitle } = render(); - const bg = getByTitle("colored button"); - const disabled = bg.getAttribute("disabled"); - assert(!disabled); - }); -}); diff --git a/tests/www/components/gallery/Features.test.tsx b/tests/www/components/gallery/Features.test.tsx deleted file mode 100644 index 7167d47b..00000000 --- a/tests/www/components/gallery/Features.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { assert, assertEquals } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Features from "$fresh/www/components/gallery/Features.tsx"; - -describe("components/gallery/Features.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should only display 2 links", () => { - const screen = render(); - const links = screen.getAllByRole("link"); - assertEquals(links.length, 2); - }); - - it("should display all feature descriptions", () => { - const screen = render(); - const desc1 = screen.getByText( - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam", - ); - assert(desc1); - const desc2 = screen.getByText( - "Nunc nisl aliquet nisl, eget aliquam nisl nisl sit amet lorem. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl,", - ); - assert(desc2); - const desc3 = screen.getByText( - "Eget aliquam nisl nisl sit amet lorem.", - ); - assert(desc3); - }); -}); diff --git a/tests/www/components/gallery/Footer.test.tsx b/tests/www/components/gallery/Footer.test.tsx deleted file mode 100644 index db28d8c2..00000000 --- a/tests/www/components/gallery/Footer.test.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { assertEquals, assertExists } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Footer from "../../../../www/components/gallery/Footer.tsx"; - -describe("Footer.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should display text", () => { - //@ts-ignore Ignore missing 'children' prop - const { getByText, getAllByText } = render(); - const fresh = getByText("Fresh"); - assertEquals(fresh.textContent, "Fresh"); - const frameworkText = getAllByText("Full Stack Framework"); - assertExists(frameworkText); - }); - - it("should display menu", () => { - //@ts-ignore Ignore missing 'children' prop - const { getByText } = render(); - const menu1 = getByText("Getting Started"); - assertExists(menu1); - const menu2 = getByText("Community"); - assertExists(menu2); - const menu3 = getByText("Discord"); - assertExists(menu3); - }); -}); diff --git a/tests/www/components/gallery/Header.test.tsx b/tests/www/components/gallery/Header.test.tsx deleted file mode 100644 index c79678ab..00000000 --- a/tests/www/components/gallery/Header.test.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { assertEquals, fail } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Header from "$fresh/www/components/gallery/Header.tsx"; - -describe("components/gallery/Header.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should show 2 links", () => { - const screen = render(); - const links = screen.getAllByRole("link"); - assertEquals(links.length, 2); - }); - - it("should show '/docs' as active", () => { - const screen = render(); - const links = screen.getAllByRole("link"); - let docsActive = false; - for (const link of links) { - if (link.getAttribute("href") === "/docs") { - if (link.classList.contains("border-b-2")) { - docsActive = true; - } - } - } - if (!docsActive) { - fail("The '/docs' link should be active!!"); - } - }); - - it("should show '/docs' as not active", () => { - const screen = render(); - const links = screen.getAllByRole("link"); - let docsActive = false; - for (const link of links) { - if (link.getAttribute("href") === "/docs") { - if (link.classList.contains("border-b-2")) { - docsActive = true; - } - } - } - if (docsActive) { - fail("The '/docs' link should NOT be active!!"); - } - }); -}); diff --git a/tests/www/components/gallery/Hero.test.tsx b/tests/www/components/gallery/Hero.test.tsx deleted file mode 100644 index b4c52b22..00000000 --- a/tests/www/components/gallery/Hero.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { assertEquals } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Hero from "$fresh/www/components/gallery/Hero.tsx"; - -describe("components/gallery/Hero.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should show 2 links", () => { - const { getAllByRole } = render(); - // Two anchor links in component - const links = getAllByRole("link"); - assertEquals(links.length, 2); - }); -}); diff --git a/tests/www/components/gallery/Input.test.tsx b/tests/www/components/gallery/Input.test.tsx deleted file mode 100644 index 57436e21..00000000 --- a/tests/www/components/gallery/Input.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { assert } from "$std/testing/asserts.ts"; -import { cleanup, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Input from "../../../../www/components/gallery/Input.tsx"; - -describe("Input.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should be disabled", () => { - const screen = render(); - const input = screen.getByPlaceholderText("text input"); - assert((input as HTMLInputElement).disabled); - }); -}); diff --git a/tests/www/components/gallery/LinkButton.test.tsx b/tests/www/components/gallery/LinkButton.test.tsx deleted file mode 100644 index e491fb62..00000000 --- a/tests/www/components/gallery/LinkButton.test.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { - assert, - assertEquals, - assertExists, - assertFalse, - assertStringIncludes, -} from "$std/testing/asserts.ts"; -import { cleanup, fireEvent, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import LinkButton from "../../../../www/components/gallery/LinkButton.tsx"; -import IconHeart from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/heart.tsx"; - -describe("components/gallery/LinkButton.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should show link button title", () => { - const screen = render( - , - ); - const anchor = screen.getByRole("link"); - const attr = anchor.getAttribute("title"); - assertEquals(attr, "Link Button"); - }); - - it("should show link button classes", () => { - const screen = render( - , - ); - const anchor = screen.getByRole("link"); - const classes = anchor.classList; - // can only test for twind classes - assert(classes.contains("rounded")); - assert(classes.contains("bg-white")); - }); - - it("should show link button text", () => { - const screen = render( - - Click Me! - , - ); - const anchor = screen.getByRole("link"); - const text = screen.getByText("Click Me!"); - assertExists(text); - }); - - it("should render IconHeart component", () => { - const screen = render( - - - Like me - , - ); - const icon = screen.getByTitle("icon-heart"); - const hidden = icon.getAttribute("aria-hidden"); - assert(hidden); - }); -}); diff --git a/tests/www/islands/Counter.test.tsx b/tests/www/islands/Counter.test.tsx deleted file mode 100644 index 832ed7be..00000000 --- a/tests/www/islands/Counter.test.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { assertExists, assertFalse } from "$std/testing/asserts.ts"; -import { cleanup, fireEvent, render, setup } from "$fresh-testing-library"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import Counter from "../../../www/islands/Counter.tsx"; - -describe("islands/Counter.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should display count and increment/decrement it correctly", async () => { - const count = 9; - const screen = render(); - const plusOne = screen.getByTitle("Add 1"); - const minusOne = screen.getByTitle("Subtract 1"); - assertExists(screen.queryByText("9")); - - await fireEvent.click(plusOne); - assertFalse(screen.queryByText("9")); - assertExists(screen.queryByText("10")); - - await fireEvent.click(minusOne); - assertExists(screen.queryByText("9")); - assertFalse(screen.queryByText("10")); - }); -}); diff --git a/tests/www/islands/SearchButton.test.tsx b/tests/www/islands/SearchButton.test.tsx deleted file mode 100644 index afcbdd07..00000000 --- a/tests/www/islands/SearchButton.test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { assert, assertExists, assertFalse } from "$std/testing/asserts.ts"; -import { - cleanup, - fireEvent, - render, - setup, -} from "$fresh-testing-library/components.ts"; -import { fn } from "$fresh-testing-library/expect.ts"; -import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts"; -import SearchButton from "../../../www/islands/SearchButton.tsx"; -import docsearch from "https://esm.sh/@docsearch/js@3?target=es2020"; - -describe("islands/SearchButton.tsx", () => { - beforeAll(setup); - afterEach(cleanup); - - it("should contain class applied in props", () => { - // create mock implementation of docsearch - // @ts-ignore mock impl - const dsearch = fn(docsearch).mockImplementation(( - applId: string, - apiKey: string, - indexName: string, - container: HTMLElement | string, - ) => {}); - const { getByTitle } = render( - , - ); - const search = getByTitle("Search Button"); - assert(search.classList.contains("font-bold")); - }); -}); diff --git a/tests/www/navigate_test.ts b/tests/www/navigate_test.ts deleted file mode 100644 index 7747112a..00000000 --- a/tests/www/navigate_test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { runBuild, waitForText, withPageName } from "../test_utils.ts"; - -Deno.test("www - docs navigation", async () => { - await runBuild("./www/dev.ts"); - await withPageName("./www/main.ts", async (page, address) => { - await page.goto(`${address}`); - - await page.click(`a[href="/docs"]`); - await waitForText(page, "h1", "Introduction"); - - await page.click(`a[href="/docs/getting-started/create-a-project"]`); - await waitForText(page, "h1", "Create a project"); - }); -}); diff --git a/tests/www/routes/index.test.tsx b/tests/www/routes/index.test.tsx deleted file mode 100644 index 1952cd12..00000000 --- a/tests/www/routes/index.test.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createHandlerContext } from "$fresh-testing-library/server.ts"; -import { expect } from "$fresh-testing-library/expect.ts"; -import { handler } from "../../../www/routes/index.tsx"; -import manifest from "../../../demo/fresh.gen.ts"; - -Deno.test("index.tsx route handler test...", async (t) => { - await t.step("should redirect to init.ts", () => { - expect(handler.GET).toBeDefined(); - const req = new Request("http://localhost:8000/"); - req.headers.set("user-agent", "Chrome"); - // @ts-ignore manifest typing doesn't matter - const ctx = createHandlerContext(req, { manifest }); - // @ts-ignore handler is not null - const resp = handler.GET(req, ctx) as Response; - expect(resp.status).toBe(307); - expect(resp.headers.get("Location")?.endsWith("init.ts")); - }); - - await t.step("should not redirect and return status=200", () => { - expect(handler.GET).toBeDefined(); - const req = new Request("http://localhost:8000/"); - req.headers.set("user-agent", "Chrome"); - req.headers.set("accept", "text/html"); - // @ts-ignore manifest typing doesn't matter - const ctx = createHandlerContext(req, { manifest }); - // mock render to return Response-like object - // @ts-ignore mock object used - ctx.render = () => { - return ({ body: "Hello World!", status: 200 }); - }; - // @ts-ignore handler is not null - const resp = handler.GET(req, ctx) as Response; - expect(resp.status).toBe(200); - }); -}); diff --git a/tests/www/routes/routes.middleware.test.tsx b/tests/www/routes/routes.middleware.test.tsx deleted file mode 100644 index e4f1c710..00000000 --- a/tests/www/routes/routes.middleware.test.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createMiddlewareHandlerContext } from "$fresh-testing-library/server.ts"; -import { expect } from "$fresh-testing-library/expect.ts"; -import { handler } from "../../../www/routes/_middleware.ts"; -import manifest from "../../../demo/fresh.gen.ts"; - -Deno.test("should return middleware status=200 & content-type", async () => { - const req = new Request(`http://localhost:3000/`); - // @ts-ignore ignores "type ... is not assignable to type Manifest" error - const ctx = createMiddlewareHandlerContext(req, { manifest }); - const resp = await handler(req, ctx); - // console.log("Response", resp); - expect(resp.status).toBe(200); - expect(resp.headers.get("content-type")).toBe("text/plain;charset=UTF-8"); -}); diff --git a/www/components/gallery/Background.tsx b/www/components/gallery/Background.tsx deleted file mode 100644 index ce5480bb..00000000 --- a/www/components/gallery/Background.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { JSX } from "preact"; - -export default function Background(props: JSX.HTMLAttributes) { - return ( - - ); -} diff --git a/www/components/gallery/Button.tsx b/www/components/gallery/Button.tsx deleted file mode 100644 index 77ed3317..00000000 --- a/www/components/gallery/Button.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { JSX } from "preact"; -import { IS_BROWSER } from "$fresh/runtime.ts"; - -export default function Button(props: JSX.HTMLAttributes) { - return ( - - ); -} diff --git a/www/components/gallery/Carousel.tsx b/www/components/gallery/Carousel.tsx deleted file mode 100644 index 9cca73e8..00000000 --- a/www/components/gallery/Carousel.tsx +++ /dev/null @@ -1,204 +0,0 @@ -import { asset } from "$fresh/runtime.ts"; -import { useSignal } from "@preact/signals"; -import { useEffect, useRef } from "preact/hooks"; -import IconCircleChevronsRight from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/circle-chevrons-right.tsx"; -import IconCircleChevronsLeft from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/circle-chevrons-left.tsx"; - -const SLIDE_DATA = [ - { - color: "bg-green-300", - text: "slide one", - url: asset("/illustration/deno-plush.svg"), - }, - { - color: "bg-yellow-300", - text: "slide two", - url: asset("/illustration/lemon-squash.svg"), - }, - { - color: "bg-blue-300", - text: "slide three", - url: asset("/illustration/deno-plush.svg"), - }, - { - color: "bg-yellow-300", - text: "slide four", - url: asset("/illustration/lemon-squash.svg"), - }, -]; - -type SlideProps = { - class?: string; - key?: number; - data: { - color: string; - text: string; - url: string; - }; -}; - -const Slide = (props: SlideProps) => { - const { key, data } = props; - const { color, text, url } = data; - if (props.class === undefined) props.class = ""; - return ( - - {text} - - - ); -}; - -type CarouselProps = { - showNavigation?: boolean; - interval?: number; - currentSlide?: number; - automatic?: boolean; - class?: string; -}; - -const Carousel = (props: CarouselProps) => { - const NAVIGATION_COLOR = `hover:text-gray-300 text-white`; - const CHEVRON_STYLE = - `absolute z-30 w-10 h-10 ${NAVIGATION_COLOR} cursor-pointer`; - const SHOW_NAVIGATION = props.showNavigation === false ? false : true; - const SLIDE_INTERVAL = props.interval ? props.interval : 3500; - const currentSlide = useSignal(props.currentSlide ? props.currentSlide : 0); - const automatic = useSignal(props.automatic === false ? false : true); - const slideshowRef = useRef(null); - - const slideClasses = (idx = 0) => { - let outgoingSlide = currentSlide.value - 1; - let incomingSlide = currentSlide.value + 1; - if (outgoingSlide === -1) outgoingSlide = SLIDE_DATA.length - 1; - if (incomingSlide === SLIDE_DATA.length) incomingSlide = 0; - const TRANSITION_CLASS = () => { - if (currentSlide.value === idx) return "translate-x-0 z-20"; - if (incomingSlide === idx) return "translate-x-full z-10"; - if (outgoingSlide === idx) return "-translate-x-full z-10"; - return "translate-x-full"; - }; - return `slide absolute top-0 left-0 transition-all ease-in-out duration-700 transform ${TRANSITION_CLASS()}`; - }; - - const nextSlide = () => { - if (SLIDE_DATA.length === currentSlide.value + 1) { - currentSlide.value = 0; - } else { - currentSlide.value++; - } - }; - - const previousSlide = () => { - if (currentSlide.value === 0) { - currentSlide.value = SLIDE_DATA.length - 1; - } else { - currentSlide.value--; - } - }; - - const chevronClick = (doCallback = () => {}) => { - if (automatic.value) automatic.value = false; - return doCallback(); - }; - - useEffect(() => { - const interval = setInterval(() => { - if (automatic.value) nextSlide(); - }, SLIDE_INTERVAL); - return () => clearInterval(interval); - }, []); - - const ArrowKeyNavigation = () => { - const keydownHandler = (event: KeyboardEvent) => { - if (automatic.value) automatic.value = false; - switch (event.code) { - case "ArrowLeft": - event.preventDefault(); - previousSlide(); - break; - case "ArrowRight": - event.preventDefault(); - nextSlide(); - break; - default: - break; - } - }; - slideshowRef.current?.addEventListener("keydown", keydownHandler); - return () => - slideshowRef.current?.removeEventListener("keydown", keydownHandler); - }; - useEffect(ArrowKeyNavigation, []); - - const goToSlide = (slide_index = 0) => { - if (automatic.value) automatic.value = false; - currentSlide.value = slide_index; - }; - - const DotsNavigation = () => ( - - {SLIDE_DATA.map((_item, idx) => { - return ( - { - goToSlide(idx); - }} - key={idx} - > - Go to slide {idx} - {idx === currentSlide.value - ? ● - : ○} - - ); - })} - - ); - - return ( - - chevronClick(previousSlide)} - > - - Previous slide - - chevronClick(nextSlide)} - > - - Next slide - - {SLIDE_DATA.map((item, idx) => ( - - ))} - {SHOW_NAVIGATION && - } - - - ); -}; - -export default Carousel; diff --git a/www/components/gallery/CodeBox.tsx b/www/components/gallery/CodeBox.tsx deleted file mode 100644 index 23d7d770..00000000 --- a/www/components/gallery/CodeBox.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { useSignal } from "@preact/signals"; - -import Prism from "https://esm.sh/prismjs@1.29.0"; -import "https://esm.sh/prismjs@1.29.0/components/prism-typescript?no-check"; - -interface CodeBoxProps { - code: string; -} - -export default function CodeBox(props: CodeBoxProps) { - const highlighted = Prism.highlight( - props.code, - Prism.languages.typescript, - "typescript", - ); - const onCopy = () => { - navigator.clipboard.writeText(props.code); - copied.value = true; - }; - - const copied = useSignal(false); - return ( - - - - Code - - - - - - - {copied.value ? "Copied!" : "Copy"} - - - - - ); -} diff --git a/www/components/gallery/ColoredButton.tsx b/www/components/gallery/ColoredButton.tsx deleted file mode 100644 index 2b7bc527..00000000 --- a/www/components/gallery/ColoredButton.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { JSX } from "preact"; -import { IS_BROWSER } from "$fresh/runtime.ts"; - -export default function ColoredButton( - props: JSX.HTMLAttributes, -) { - return ( - - ); -} diff --git a/www/components/gallery/Features.tsx b/www/components/gallery/Features.tsx deleted file mode 100644 index 4addb0cb..00000000 --- a/www/components/gallery/Features.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import IconAlarm from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/alarm.tsx"; -import IconAirBalloon from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/air-balloon.tsx"; -import IconArmchair from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/armchair.tsx"; -import IconChevronRight from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/chevron-right.tsx"; - -export default function Features() { - const featureItems = [ - { - icon: IconAlarm, - description: - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc ut aliquam aliquam", - link: "#", - }, - { - icon: IconAirBalloon, - description: - "Nunc nisl aliquet nisl, eget aliquam nisl nisl sit amet lorem. Sed euismod, nunc ut aliquam aliquam, nunc nisl aliquet nisl, ", - }, - { - icon: IconArmchair, - description: "Eget aliquam nisl nisl sit amet lorem.", - link: "#", - }, - ]; - - return ( - - {featureItems.map((item) => { - return ( - - - - - - {item.description} - - - {item.link && - ( - - - Read More{" "} - - - - )} - - ); - })} - - ); -} diff --git a/www/components/gallery/Footer.tsx b/www/components/gallery/Footer.tsx deleted file mode 100644 index c7599c9a..00000000 --- a/www/components/gallery/Footer.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import LemonIcon from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/lemon-2.tsx"; -import BrandGithub from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/brand-github.tsx"; - -export default function Footer() { - const menus = [ - { - title: "Documentation", - children: [ - { name: "Getting Started", href: "#" }, - { name: "Guide", href: "#" }, - { name: "API", href: "#" }, - { name: "Showcase", href: "#" }, - { name: "Pricing", href: "#" }, - ], - }, - { - title: "Community", - children: [ - { name: "Forum", href: "#" }, - { name: "Discord", href: "#" }, - ], - }, - ]; - - return ( - - - - - - Fresh - - - - Full Stack Framework - - - - {menus.map((item) => ( - - {item.title} - - {item.children.map((child) => ( - - - {child.name} - - - ))} - - - ))} - - - - Copyright © 2020 DenoLand - All right reserved. - - - - - - - - ); -} diff --git a/www/components/gallery/Header.tsx b/www/components/gallery/Header.tsx deleted file mode 100644 index 02fa97ea..00000000 --- a/www/components/gallery/Header.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import LemonIcon from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/lemon-2.tsx"; - -type Props = { - active: string; -}; - -export default function Header({ active }: Props) { - const menus = [ - { name: "Home", href: "/" }, - // { name: "Components", href: "/components" }, - { name: "Docs", href: "/docs" }, - ]; - - return ( - - - - - Fresh - - - - {menus.map((menu) => ( - - - {menu.name} - - - ))} - - - ); -} diff --git a/www/components/gallery/Hero.tsx b/www/components/gallery/Hero.tsx deleted file mode 100644 index 9d489dc7..00000000 --- a/www/components/gallery/Hero.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import IconChevronRight from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/chevron-right.tsx"; - -export default function Hero() { - return ( - - - Fresh Components Beta - - Fresh Components is a collection of components built with Preact and - Tailwind CSS. - - - - - - Sign Up{" "} - - - Documentation{" "} - - - - - ); -} diff --git a/www/components/gallery/Input.tsx b/www/components/gallery/Input.tsx deleted file mode 100644 index 2d5f33b6..00000000 --- a/www/components/gallery/Input.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { JSX } from "preact"; -import { IS_BROWSER } from "$fresh/runtime.ts"; - -export default function Input(props: JSX.HTMLAttributes) { - return ( - - ); -} diff --git a/www/components/gallery/LinkButton.tsx b/www/components/gallery/LinkButton.tsx deleted file mode 100644 index a87284d2..00000000 --- a/www/components/gallery/LinkButton.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { JSX } from "preact"; - -export default function LinkButton( - props: JSX.HTMLAttributes, -) { - return ( - - ); -} diff --git a/www/deno.json b/www/deno.json index 049f9337..5b00c42c 100644 --- a/www/deno.json +++ b/www/deno.json @@ -17,8 +17,6 @@ "$std/": "https://deno.land/std@0.216.0/", "$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts", "$marked-mangle": "https://esm.sh/marked-mangle@1.1.7", - "$fresh-testing-library": "https://deno.land/x/fresh_testing_library@0.8.0/mod.ts", - "$fresh-testing-library/": "https://deno.land/x/fresh_testing_library@0.8.0/", "tailwindcss": "npm:tailwindcss@3.4.1", "tailwindcss/": "npm:/tailwindcss@3.4.1/", "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js" diff --git a/www/fresh.gen.ts b/www/fresh.gen.ts index 8df47f1f..bc654923 100644 --- a/www/fresh.gen.ts +++ b/www/fresh.gen.ts @@ -17,7 +17,6 @@ import * as $recipes_lemonade from "./routes/recipes/lemonade.tsx"; import * as $recipes_lemondrop from "./routes/recipes/lemondrop.tsx"; import * as $showcase from "./routes/showcase.tsx"; import * as $update from "./routes/update.tsx"; -import * as $ComponentGallery from "./islands/ComponentGallery.tsx"; import * as $CopyArea from "./islands/CopyArea.tsx"; import * as $Counter from "./islands/Counter.tsx"; import * as $LemonBottom from "./islands/LemonBottom.tsx"; @@ -47,7 +46,6 @@ const manifest = { "./routes/update.tsx": $update, }, islands: { - "./islands/ComponentGallery.tsx": $ComponentGallery, "./islands/CopyArea.tsx": $CopyArea, "./islands/Counter.tsx": $Counter, "./islands/LemonBottom.tsx": $LemonBottom, diff --git a/www/islands/ComponentGallery.tsx b/www/islands/ComponentGallery.tsx deleted file mode 100644 index dad1001d..00000000 --- a/www/islands/ComponentGallery.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import Button from "../components/gallery/Button.tsx"; -import LinkButton from "../components/gallery/LinkButton.tsx"; -import ColoredButton from "../components/gallery/ColoredButton.tsx"; -import Input from "../components/gallery/Input.tsx"; -import Header from "../components/gallery/Header.tsx"; -import Footer from "../components/gallery/Footer.tsx"; -import Hero from "../components/gallery/Hero.tsx"; -import Features from "../components/gallery/Features.tsx"; -import Carousel from "../components/gallery/Carousel.tsx"; -import { ComponentChildren } from "preact"; -import IconHappy from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/mood-crazy-happy.tsx"; -import IconHeart from "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/heart.tsx"; -import Background from "../components/gallery/Background.tsx"; -import CodeBox from "../components/gallery/CodeBox.tsx"; - -interface SectionProps { - title: string; - children: ComponentChildren; - source: string; - island?: boolean; -} - -function Section(props: SectionProps) { - return ( - - - {props.title} - {props.island && ( - - island - - )} - - - - {props.children} - - - - - ); -} - -interface ComponentGalleryProps { - sources: Record; -} - -export default function ComponentGallery(props: ComponentGalleryProps) { - return ( - <> - - - Click me - - - - - With an Icon - - - - Disabled - - - - - Click me - - - - - - - Like me - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - ); -}
- -
- {item.description} -
- Read More{" "} - -
- Fresh Components is a collection of components built with Preact and - Tailwind CSS. -