From 25d4d16a8f530eab03c7502a0e2ebe069635df47 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 17 May 2024 18:39:32 +0200 Subject: [PATCH] www: fully remove component gallery (#2430) --- .vscode/import_map.json | 2 - .../components/gallery/Background.test.tsx | 16 -- tests/www/components/gallery/Button.test.tsx | 18 -- .../www/components/gallery/Carousel.test.tsx | 17 -- tests/www/components/gallery/CodeBox.test.tsx | 43 ---- .../components/gallery/ColoredButton.test.tsx | 16 -- .../www/components/gallery/Features.test.tsx | 31 --- tests/www/components/gallery/Footer.test.tsx | 29 --- tests/www/components/gallery/Header.test.tsx | 47 ---- tests/www/components/gallery/Hero.test.tsx | 16 -- tests/www/components/gallery/Input.test.tsx | 15 -- .../components/gallery/LinkButton.test.tsx | 63 ------ tests/www/islands/Counter.test.tsx | 25 --- tests/www/islands/SearchButton.test.tsx | 32 --- tests/www/navigate_test.ts | 14 -- tests/www/routes/index.test.tsx | 35 --- tests/www/routes/routes.middleware.test.tsx | 14 -- www/components/gallery/Background.tsx | 11 - www/components/gallery/Button.tsx | 14 -- www/components/gallery/Carousel.tsx | 204 ------------------ www/components/gallery/CodeBox.tsx | 44 ---- www/components/gallery/ColoredButton.tsx | 14 -- www/components/gallery/Features.tsx | 55 ----- www/components/gallery/Footer.tsx | 73 ------- www/components/gallery/Header.tsx | 37 ---- www/components/gallery/Hero.tsx | 37 ---- www/components/gallery/Input.tsx | 14 -- www/components/gallery/LinkButton.tsx | 14 -- www/deno.json | 2 - www/fresh.gen.ts | 2 - www/islands/ComponentGallery.tsx | 125 ----------- 31 files changed, 1079 deletions(-) delete mode 100644 tests/www/components/gallery/Background.test.tsx delete mode 100644 tests/www/components/gallery/Button.test.tsx delete mode 100644 tests/www/components/gallery/Carousel.test.tsx delete mode 100644 tests/www/components/gallery/CodeBox.test.tsx delete mode 100644 tests/www/components/gallery/ColoredButton.test.tsx delete mode 100644 tests/www/components/gallery/Features.test.tsx delete mode 100644 tests/www/components/gallery/Footer.test.tsx delete mode 100644 tests/www/components/gallery/Header.test.tsx delete mode 100644 tests/www/components/gallery/Hero.test.tsx delete mode 100644 tests/www/components/gallery/Input.test.tsx delete mode 100644 tests/www/components/gallery/LinkButton.test.tsx delete mode 100644 tests/www/islands/Counter.test.tsx delete mode 100644 tests/www/islands/SearchButton.test.tsx delete mode 100644 tests/www/navigate_test.ts delete mode 100644 tests/www/routes/index.test.tsx delete mode 100644 tests/www/routes/routes.middleware.test.tsx delete mode 100644 www/components/gallery/Background.tsx delete mode 100644 www/components/gallery/Button.tsx delete mode 100644 www/components/gallery/Carousel.tsx delete mode 100644 www/components/gallery/CodeBox.tsx delete mode 100644 www/components/gallery/ColoredButton.tsx delete mode 100644 www/components/gallery/Features.tsx delete mode 100644 www/components/gallery/Footer.tsx delete mode 100644 www/components/gallery/Header.tsx delete mode 100644 www/components/gallery/Hero.tsx delete mode 100644 www/components/gallery/Input.tsx delete mode 100644 www/components/gallery/LinkButton.tsx delete mode 100644 www/islands/ComponentGallery.tsx 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( - - ); - })} - - ); - - return ( -
- - - {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 - -
-
-            
-          
- -
-
-
- ); -} 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 ( - - - - -
- - Click me - -
- -
- - -
- -
- - -
- -
-
-
- -
-
-
- -
- -
- -
- -
- -
- -
- - ); -}