From 02f2c2ff75b953d67d4f27524b5a5cd4a24c8d9f Mon Sep 17 00:00:00 2001 From: Cristhian Melo Date: Fri, 16 May 2025 15:53:00 -0500 Subject: [PATCH 1/3] refactor: enhance Container component with tag prop for better semantic markup --- src/components/Container.astro | 11 ++- src/components/partials/Footer.astro | 12 ++- src/components/partials/Header.astro | 46 +++++----- src/pages/index.astro | 123 +++++++++++++-------------- src/pages/writing/[...slug].astro | 52 ++++++----- src/pages/writing/index.astro | 28 +++--- 6 files changed, 129 insertions(+), 143 deletions(-) diff --git a/src/components/Container.astro b/src/components/Container.astro index 289e550..745ad73 100644 --- a/src/components/Container.astro +++ b/src/components/Container.astro @@ -1,10 +1,15 @@ --- -const { class: className } = Astro.props; +interface Props { + tag?: keyof Pick; + class?: string +} + +const { tag: Tag = 'div', class: className } = Astro.props; --- -
-
+ diff --git a/src/components/partials/Footer.astro b/src/components/partials/Footer.astro index 4a397a3..76e8a1f 100644 --- a/src/components/partials/Footer.astro +++ b/src/components/partials/Footer.astro @@ -2,10 +2,8 @@ import Container from '@/components/Container.astro'; --- -
- -

- © {new Date().getFullYear()}. Powered by Astro and CVfolio. -

-
-
\ No newline at end of file + +

+ © {new Date().getFullYear()}. Powered by Astro and CVfolio. +

+
diff --git a/src/components/partials/Header.astro b/src/components/partials/Header.astro index d0b075b..006008d 100644 --- a/src/components/partials/Header.astro +++ b/src/components/partials/Header.astro @@ -8,27 +8,25 @@ const isWritingPage = pathname.startsWith('/writing'); --- -
- -
- -
-
-
\ No newline at end of file + +
+ +
+
diff --git a/src/pages/index.astro b/src/pages/index.astro index 725412e..c245150 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -18,83 +18,74 @@ const talks = await getCollection('talks'); --- -
- - - -
-
- -
-
- About -
-
- -
+ + + + + +
+
+ About +
+
+
- -
+ + { links.length > 0 && ( -
- -
- Contact - -
-
-
+ +
+ Contact + +
+
) } { sortedJobs.length > 0 && ( -
- -
- Work Experience -
    - {sortedJobs.map((job) => ( - - ))} -
-
-
-
+ +
+ Work Experience +
    + {sortedJobs.map((job) => ( + + ))} +
+
+
) } { talks.length > 0 && ( -
- -
- Speaking -
    - {talks.map((talk) => ( - - ))} -
-
-
-
+ +
+ Speaking +
    + {talks.map((talk) => ( + + ))} +
+
+
) }
diff --git a/src/pages/writing/[...slug].astro b/src/pages/writing/[...slug].astro index 9a71b56..f6b78cb 100644 --- a/src/pages/writing/[...slug].astro +++ b/src/pages/writing/[...slug].astro @@ -20,33 +20,31 @@ const { Content } = await render(entry); --- -
- -
-
- - Back to writing - -
- - {DEFAULT_CONFIGURATION.author.name} -
-

{entry.data.title}

+ +
+
+ + Back to writing + +
+ + {DEFAULT_CONFIGURATION.author.name}
- {entry.data.image && ( -
- {entry.data.title} -
- )} -
- +

{entry.data.title}

+
+ {entry.data.image && ( +
+ {entry.data.title}
-
-
-
+ )} +
+ +
+ +
- \ No newline at end of file + diff --git a/src/pages/writing/index.astro b/src/pages/writing/index.astro index 57d3c36..63b8a2b 100644 --- a/src/pages/writing/index.astro +++ b/src/pages/writing/index.astro @@ -11,19 +11,15 @@ const posts = await getCollection('posts'); --- -
- - - -
-
- -
- Latest posts -
    - {posts.map((post) => )} -
-
-
-
-
\ No newline at end of file + + + + +
+ Latest posts +
    + {posts.map((post) => )} +
+
+
+ From 6877032ae38fb9ca1d660a5b1b859f42e776f281 Mon Sep 17 00:00:00 2001 From: Cristhian Melo Date: Tue, 20 May 2025 01:37:15 +0000 Subject: [PATCH 2/3] refactor(container): rename `tag` prop to `as` for consistency with Astro conventions --- src/components/Container.astro | 4 ++-- src/components/partials/Footer.astro | 2 +- src/components/partials/Header.astro | 2 +- src/pages/index.astro | 10 +++++----- src/pages/writing/[...slug].astro | 2 +- src/pages/writing/index.astro | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/Container.astro b/src/components/Container.astro index 745ad73..e566ab9 100644 --- a/src/components/Container.astro +++ b/src/components/Container.astro @@ -1,10 +1,10 @@ --- interface Props { - tag?: keyof Pick; + as: keyof Pick; class?: string } -const { tag: Tag = 'div', class: className } = Astro.props; +const { as: Tag, class: className } = Astro.props; --- +

© {new Date().getFullYear()}. Powered by Astro and CVfolio.

diff --git a/src/components/partials/Header.astro b/src/components/partials/Header.astro index 006008d..0c4662c 100644 --- a/src/components/partials/Header.astro +++ b/src/components/partials/Header.astro @@ -8,7 +8,7 @@ const isWritingPage = pathname.startsWith('/writing'); --- - +