From 85c3cfa7780b39b9ccef1dc8da21cde19eb9e394 Mon Sep 17 00:00:00 2001 From: Thomas Cole Date: Wed, 21 Dec 2022 17:07:25 -0500 Subject: [PATCH] Working on projects page. --- astro.config.mjs | 5 +- package.json | 2 + src/components/nav/Nav.astro | 4 +- src/layouts/BlogLayout.astro | 2 +- src/layouts/InteractiveDemoLayout.astro | 16 +++ src/pages/blog/[page].astro | 92 +++++++------ src/pages/index.astro | 21 ++- src/pages/projects/[page].astro | 59 +++++++++ src/pages/projects/demo.mdx | 13 ++ src/pages/projects/demo/quicksort.svelte | 156 +++++++++++++++++++++++ src/pages/resume.astro | 5 +- 11 files changed, 318 insertions(+), 57 deletions(-) create mode 100644 src/layouts/InteractiveDemoLayout.astro create mode 100644 src/pages/projects/[page].astro create mode 100644 src/pages/projects/demo.mdx create mode 100644 src/pages/projects/demo/quicksort.svelte diff --git a/astro.config.mjs b/astro.config.mjs index 063a245..61cb65e 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -6,7 +6,10 @@ import tailwind from "@astrojs/tailwind"; // https://astro.build/config import svelte from "@astrojs/svelte"; +// https://astro.build/config +import mdx from "@astrojs/mdx"; + // https://astro.build/config export default defineConfig({ - integrations: [tailwind(), svelte()] + integrations: [tailwind(), svelte(), mdx()] }); \ No newline at end of file diff --git a/package.json b/package.json index 71b6e5d..1ebe095 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,12 @@ "astro": "astro" }, "dependencies": { + "@astrojs/mdx": "^0.13.0", "@astrojs/svelte": "^1.0.2", "@astrojs/tailwind": "^2.1.3", "astro": "^1.6.15", "daisyui": "^2.45.0", + "p5-svelte": "^3.1.2", "svelte": "^3.55.0", "tailwindcss": "^3.2.4", "theme-change": "^2.2.0" diff --git a/src/components/nav/Nav.astro b/src/components/nav/Nav.astro index a8f5dc4..7679b34 100644 --- a/src/components/nav/Nav.astro +++ b/src/components/nav/Nav.astro @@ -25,7 +25,7 @@
  • - +
  • @@ -40,7 +40,7 @@
  • - +
  • diff --git a/src/layouts/BlogLayout.astro b/src/layouts/BlogLayout.astro index d9accf1..e44d8b8 100644 --- a/src/layouts/BlogLayout.astro +++ b/src/layouts/BlogLayout.astro @@ -6,7 +6,7 @@ const { frontmatter } = Astro.props; --- -
    +

    {frontmatter.title}

    {frontmatter.date}

    diff --git a/src/layouts/InteractiveDemoLayout.astro b/src/layouts/InteractiveDemoLayout.astro new file mode 100644 index 0000000..e44d8b8 --- /dev/null +++ b/src/layouts/InteractiveDemoLayout.astro @@ -0,0 +1,16 @@ +--- +import Divider from "../components/misc/Divider.astro"; +import Layout from "./Layout.astro"; + +const { frontmatter } = Astro.props; +--- + + +
    + +

    {frontmatter.title}

    +

    {frontmatter.date}

    + + +
    +
    \ No newline at end of file diff --git a/src/pages/blog/[page].astro b/src/pages/blog/[page].astro index f5a8cc1..7195705 100644 --- a/src/pages/blog/[page].astro +++ b/src/pages/blog/[page].astro @@ -1,65 +1,59 @@ --- -import Layout from "../../layouts/Layout.astro"; -import BlogProjectCard from "../../components/misc/BlogProjectCard.astro"; -import Divider from "../../components/misc/Divider.astro"; + import Layout from "../../layouts/Layout.astro"; + import BlogProjectCard from "../../components/misc/BlogProjectCard.astro"; + import Divider from "../../components/misc/Divider.astro"; -export async function getStaticPaths({ paginate }: { paginate: any }) { - const posts = (await Astro.glob("./*.{md,mdx}")).sort( - (a, b) => - new Date(b.frontmatter.date).valueOf() - - new Date(a.frontmatter.date).valueOf() - ); + export async function getStaticPaths({ paginate }: { paginate: any }) { + const posts = (await Astro.glob("./*.{md,mdx}")).sort( + (a, b) => + new Date(b.frontmatter.date).valueOf() - + new Date(a.frontmatter.date).valueOf() + ); - return paginate(posts, { pageSize: 10 }); -} + return paginate(posts, { pageSize: 10 }); + } -const { page } = Astro.props; + const { page } = Astro.props; --- -
    - { +
    +
    + { page.data.map((post: any) => ( - <> - - - + + )) - } -
    - -
    - { + } +
    +
    + { page.url.prev ? ( - - - chevron_left - -

    Previous Page

    -
    + + + chevron_left + +

    Previous Page

    +
    ) : ( -
    +
    ) - } - -

    Page {page.currentPage}

    + } - { +

    Page {page.currentPage}

    + { page.url.next ? ( - -

    Next Page

    - - chevron_right - -
    + +

    Next Page

    + + chevron_right + +
    ) : ( -
    +
    ) - } -
    - + } +
    +
    + \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 5a4df6c..0d66f1d 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -9,10 +9,16 @@ const posts = (await Astro.glob("./blog/*.{md,mdx}")) new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf() ); + +const projects = (await Astro.glob("./projects/*.{md,mdx}")).sort( + (a,b) => + new Date(b.frontmatter.date).valueOf()- + new Date(a.frontmatter.date).valueOf() +) --- -
    +

    Hello World 👋

    I'm glad you are here!

    @@ -27,7 +33,7 @@ const posts = (await Astro.glob("./blog/*.{md,mdx}"))

    Latest Projects

    { - posts.map((post) => ( + projects.map((post) => (

    Latest Blog Posts

    + { + posts.map((post) => ( + + + )) + }
    diff --git a/src/pages/projects/[page].astro b/src/pages/projects/[page].astro new file mode 100644 index 0000000..f3f23bb --- /dev/null +++ b/src/pages/projects/[page].astro @@ -0,0 +1,59 @@ +--- + import Layout from "../../layouts/Layout.astro"; + import Divider from "../../components/misc/Divider.astro"; + import BlogProjectCard from "../../components/misc/BlogProjectCard.astro"; + + export async function getStaticPaths({ paginate }: { paginate: any }) { + const posts = (await Astro.glob("./*.{md,mdx}")).sort( + (a, b) => + new Date(b.frontmatter.date).valueOf() - + new Date(a.frontmatter.date).valueOf() + ); + + return paginate(posts, { pageSize: 10 }); + } + + const { page } = Astro.props; +--- + + +
    +
    + { + page.data.map((post: any) => ( + + + )) + } +
    +
    + { + page.url.prev ? ( + + + chevron_left + +

    Previous Page

    +
    + ) : ( +
    + ) + } + +

    Page {page.currentPage}

    + { + page.url.next ? ( + +

    Next Page

    + + chevron_right + +
    + ) : ( +
    + ) + } +
    +
    +
    \ No newline at end of file diff --git a/src/pages/projects/demo.mdx b/src/pages/projects/demo.mdx new file mode 100644 index 0000000..5043427 --- /dev/null +++ b/src/pages/projects/demo.mdx @@ -0,0 +1,13 @@ +--- +layout: "../../layouts/InteractiveDemoLayout.astro" +title: "Quicksort Demo" +tagline: "A simple visualization of the quicksort algorithm using svelte" +date: "Sep 10 2022" +image: "/img/profile.jpg" +--- + +import Quicksort from './demo/quicksort.svelte'; + +# Quicksort + + \ No newline at end of file diff --git a/src/pages/projects/demo/quicksort.svelte b/src/pages/projects/demo/quicksort.svelte new file mode 100644 index 0000000..52d540e --- /dev/null +++ b/src/pages/projects/demo/quicksort.svelte @@ -0,0 +1,156 @@ + + + +
    + + + +
    \ No newline at end of file diff --git a/src/pages/resume.astro b/src/pages/resume.astro index c84c8d6..570a44a 100644 --- a/src/pages/resume.astro +++ b/src/pages/resume.astro @@ -12,7 +12,7 @@ } -
    +

    About Me

    Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus esse inventore iusto earum asperiores necessitatibus, dolores id cumque nesciunt libero eligendi vel reprehenderit eius officia. Veritatis dolorum illum exercitationem suscipit.

    @@ -63,7 +63,7 @@

    Skills

    -
      +
      • HTML
      • CSS
      • JavaScript
      • @@ -82,6 +82,7 @@
      • Active Directory
      • Cisco IOS
      • Ubiquiti Unifi
      • +
      • 3CX