Skip to content

Commit f5c6507

Browse files
committed
move frontend projects back to home grid, add order property
1 parent 99292af commit f5c6507

7 files changed

Lines changed: 37 additions & 12 deletions

File tree

src/components/Header.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import { SITE_TITLE } from '@/consts';
1616
>
1717
{SITE_TITLE}
1818
</a>
19-
<!-- <div class="text-xs tracking-wide opacity-60">{SITE_DESCRIPTION}</div> -->
19+
<div class="tracking-wide opacity-60">3D / Front End Web Dev</div>
2020
</div>
2121
<ul class="flex flex-wrap justify-center sm:ms-auto lg:mb-0">
22-
<HeaderLink href="/">3D</HeaderLink>
23-
<HeaderLink href="/frontend">Front End</HeaderLink>
22+
<HeaderLink href="/">Work</HeaderLink>
23+
<!-- <HeaderLink href="/frontend">Front End</HeaderLink> -->
2424
<HeaderLink href="/about">About</HeaderLink>
2525
<HeaderLink href="/resume">Resume</HeaderLink>
2626
<!-- <HeaderLink href="/blog">Blog</HeaderLink> -->

src/content.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const work = defineCollection({
2727
tags: z.array(z.string()),
2828
img: z.string(),
2929
img_alt: z.string().optional(),
30+
order: z.number().optional(),
3031
}),
3132
});
3233

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ category: frontend
88
tags:
99
- Bootstrap
1010
- SCSS
11+
archive: true
1112
---
1213

1314
<ExternalLink href="https://davidlyons.bitbucket.io/borden-dairy/templates/index.html" />

src/content/work/bp-pulse.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tags:
1515
- TypeScript
1616
- GraphQL
1717
- Storybook
18+
order: 2
1819
---
1920

2021
<ExternalLink href="https://www.bppulse.com" />

src/content/work/poi.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ tags:
1313
- Material UI
1414
- SCSS
1515
- Vite
16+
category: frontend
17+
order: 1
1618
---
1719

1820
<Iframe src="https://flowarts.xyz" aspect="retro" />

src/pages/index.astro

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ import BaseLayout from '@/layouts/BaseLayout.astro';
44
import PortfolioPreview from '@/components/PortfolioPreview.astro';
55
import { SITE_DESCRIPTION } from '@/consts';
66
7-
const projects = (await getCollection('work'))
8-
.filter((project) => project.data.category !== 'frontend')
9-
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
7+
const projects = await getCollection('work');
8+
9+
projects.sort((a, b) => {
10+
// ascending by order
11+
if (a.data.order || b.data.order) {
12+
return (a.data.order || projects.length) - (b.data.order || projects.length);
13+
}
14+
15+
// descending by published date
16+
return b.data.pubDate.valueOf() - a.data.pubDate.valueOf();
17+
});
1018
---
1119

1220
<BaseLayout title={SITE_DESCRIPTION}>
13-
<div class="grid grid-cols-2 gap-2.5 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
21+
<div class="grid grid-cols-2 gap-2.5 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6">
1422
{projects.map((project) => <PortfolioPreview project={project} />)}
1523
</div>
1624
</BaseLayout>

src/pages/work/[...slug].astro

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@ const { title, description, pubDate, tags } = entry.data;
2424
const { Content } = await render(entry);
2525
2626
// Get all entries in current category for prev/next arrow navigation
27-
const projects = (await getCollection('work'))
28-
.filter((project) => project.data.category === entry.data.category)
29-
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
27+
const projects = await getCollection('work');
28+
29+
projects.sort((a, b) => {
30+
// ascending by order
31+
if (a.data.order || b.data.order) {
32+
return (a.data.order || projects.length) - (b.data.order || projects.length);
33+
}
34+
35+
// descending by published date
36+
return b.data.pubDate.valueOf() - a.data.pubDate.valueOf();
37+
});
3038
3139
const currentIndex = projects.findIndex(({ id }) => id === entry.id);
3240
const prevEntry = projects[(currentIndex - 1 + projects.length) % projects.length];
@@ -44,7 +52,8 @@ const nextEntry = projects[(currentIndex + 1) % projects.length];
4452
<a
4553
href={`/work/${prevEntry.id}`}
4654
aria-label="Previous"
47-
class="py-1 pr-3 pl-1 opacity-60 transition-opacity hover:opacity-100 dark:text-white"
55+
class="py-1 pr-3 pl-1 opacity-60 transition-opacity hover:opacity-100
56+
dark:text-white"
4857
>
4958
<Icon name="arrow-left" size={20} />
5059
</a>
@@ -78,7 +87,10 @@ const nextEntry = projects[(currentIndex + 1) % projects.length];
7887
{
7988
tags.map((tag) => (
8089
<li class="leading-none">
81-
<span class="inline-flex items-center rounded-md px-2 py-1 text-xs font-medium dark:bg-gray-600 dark:text-white">
90+
<span
91+
class="inline-flex items-center rounded-md px-2 py-1 text-xs font-medium
92+
dark:bg-gray-600 dark:text-white"
93+
>
8294
{iconMap[tag] && <Icon name={iconMap[tag]} size={16} class="me-2" />} {tag}
8395
</span>
8496
</li>

0 commit comments

Comments
 (0)