From fab45197241b8071df7f9e92e7346fed11397f58 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 8 Jan 2023 23:36:25 +0000 Subject: [PATCH] feat: add examples --- src/components/Link.astro | 14 ++++++ src/layouts/Layout.astro | 15 ++++++ src/pages/css-component.astro | 22 +++++++++ src/pages/html-component.astro | 16 ++++++ src/pages/index.astro | 60 ++++++++++++++++++----- src/pages/loops-and-html-components.astro | 30 ++++++++++++ src/pages/loops.astro | 34 +++++++++++++ src/pages/variables.astro | 18 +++++++ tsconfig.json | 10 +++- 9 files changed, 205 insertions(+), 14 deletions(-) create mode 100644 src/components/Link.astro create mode 100644 src/layouts/Layout.astro create mode 100644 src/pages/css-component.astro create mode 100644 src/pages/html-component.astro create mode 100644 src/pages/loops-and-html-components.astro create mode 100644 src/pages/loops.astro create mode 100644 src/pages/variables.astro diff --git a/src/components/Link.astro b/src/components/Link.astro new file mode 100644 index 0000000..0351cd6 --- /dev/null +++ b/src/components/Link.astro @@ -0,0 +1,14 @@ +--- +interface Props { + name: string; +} + +const { name } = Astro.props; +--- + + + {name} + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro new file mode 100644 index 0000000..a442ba8 --- /dev/null +++ b/src/layouts/Layout.astro @@ -0,0 +1,15 @@ +--- +--- + + + + + + + + Astro + + + + + diff --git a/src/pages/css-component.astro b/src/pages/css-component.astro new file mode 100644 index 0000000..e3788ce --- /dev/null +++ b/src/pages/css-component.astro @@ -0,0 +1,22 @@ +--- +import Layout from "~/layouts/Layout.astro"; +--- + + + + + + diff --git a/src/pages/html-component.astro b/src/pages/html-component.astro new file mode 100644 index 0000000..6371d49 --- /dev/null +++ b/src/pages/html-component.astro @@ -0,0 +1,16 @@ +--- +import Layout from "~/layouts/Layout.astro"; +import Link from "~/components/Link.astro"; +--- + + +
    +
  • +
  • +
  • +
  • +
  • +
+
diff --git a/src/pages/index.astro b/src/pages/index.astro index 7264ff5..c37bda1 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,15 +1,51 @@ --- +import Layout from "~/layouts/Layout.astro"; --- - - - - - - - Astro - - -

Astro

- - + + + diff --git a/src/pages/loops-and-html-components.astro b/src/pages/loops-and-html-components.astro new file mode 100644 index 0000000..7d7c9cb --- /dev/null +++ b/src/pages/loops-and-html-components.astro @@ -0,0 +1,30 @@ +--- +import Layout from "~/layouts/Layout.astro"; +import Link from "~/components/Link.astro"; + +type LinkItem = { + name: string; +}; + +const links: LinkItem[] = [ + { name: "About" }, + { name: "Blog" }, + { name: "Talks" }, + { name: "Daily list" }, + { name: "Search" }, +]; +--- + + +
    + { + links.map(link => ( +
  • + +
  • + )) + } +
+
diff --git a/src/pages/loops.astro b/src/pages/loops.astro new file mode 100644 index 0000000..7484b05 --- /dev/null +++ b/src/pages/loops.astro @@ -0,0 +1,34 @@ +--- +import Layout from "~/layouts/Layout.astro"; + +type LinkItem = { + name: string; +}; + +const links: LinkItem[] = [ + { name: "About" }, + { name: "Blog" }, + { name: "Talks" }, + { name: "Daily list" }, + { name: "Search" }, +]; +--- + + + + diff --git a/src/pages/variables.astro b/src/pages/variables.astro new file mode 100644 index 0000000..5abcf8a --- /dev/null +++ b/src/pages/variables.astro @@ -0,0 +1,18 @@ +--- +import Layout from "~/layouts/Layout.astro"; + +const linkClasses = + "py-2 block border-b-2 border-transparent hover:border-blue-500 hover:text-blue-500 focus:outline-none focus:bg-yellow-400 focus:border-current"; +--- + + + + diff --git a/tsconfig.json b/tsconfig.json index 77da9dd..0e91d73 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,9 @@ { - "extends": "astro/tsconfigs/strict" -} \ No newline at end of file + "extends": "astro/tsconfigs/strict", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "~/*": ["src/*"], + } + } +}