Skip to content

Commit e4fe1af

Browse files
committed
Merge #14: fix npm run dev error and separate blog and home routes
e62359d fix npm run dev error and separate blog and home routes (Graeme Byrne) Pull request description: * Fix `npm run dev error` as described [here](#5) by removing images and replacing them with CSS gradients as outlined in the designer's Figma design. * Separate `(home)` and `blog` into separate routes to make clear where each goes. Also change individual blog posts routes' name from `(blog)` to `(article)` to avoid confusion with `blog` route. ACKs for top commit: josecelano: ACK e62359d Tree-SHA512: 27cd0243a85084eacbcb865fab0656a422fd0e4de7397931a40021ec70a0a4cbf10b5d42b919948c689ccf00f7a0ebf7eb20d1c6b87f4064aec8dc3564aca4a6
2 parents e4e4ef7 + e62359d commit e4fe1af

File tree

30 files changed

+31
-67
lines changed

30 files changed

+31
-67
lines changed

.github/workflows/stale.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ name: Mark stale issues and pull requests
77

88
on:
99
schedule:
10-
- cron: '38 5 * * *'
10+
- cron: '38 5 * * *'
1111

1212
jobs:
1313
stale:
14-
1514
runs-on: ubuntu-latest
1615
permissions:
1716
issues: write
1817
pull-requests: write
1918

2019
steps:
21-
- uses: actions/stale@v5
22-
with:
23-
repo-token: ${{ secrets.GITHUB_TOKEN }}
24-
stale-issue-message: 'Stale issue message'
25-
stale-pr-message: 'Stale pull request message'
26-
stale-issue-label: 'no-issue-activity'
27-
stale-pr-label: 'no-pr-activity'
20+
- uses: actions/stale@v5
21+
with:
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
stale-issue-message: 'Stale issue message'
24+
stale-pr-message: 'Stale pull request message'
25+
stale-issue-label: 'no-issue-activity'
26+
stale-pr-label: 'no-pr-activity'

src/lib/components/atoms/Cards.svelte

+19-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,28 @@
44
export let additionalClass: string | undefined = undefined;
55
66
export let href: string | undefined = undefined;
7-
export let backgroundImage: string | undefined = undefined;
87
const isExternalLink = !!href && HttpRegex.test(href);
98
export let target: '_self' | '_blank' = isExternalLink ? '_blank' : '_self';
109
export let rel = isExternalLink ? 'noopener noreferrer' : undefined;
1110
11+
function getRandomColor() {
12+
const letters = '0123456789ABCDEF';
13+
let color = '#';
14+
for (let i = 0; i < 6; i++) {
15+
color += letters[Math.floor(Math.random() * 16)];
16+
}
17+
return color;
18+
}
19+
20+
function getRandomGradient() {
21+
const color1 = getRandomColor();
22+
const color2 = getRandomColor();
23+
const randomDegree = Math.floor(Math.random() * 360);
24+
return `linear-gradient(${randomDegree}deg, ${color1}, ${color2})`;
25+
}
26+
27+
$: randomGradientBackground = getRandomGradient();
28+
1229
$: tag = href ? 'a' : 'article';
1330
$: linkProps = {
1431
href,
@@ -23,12 +40,8 @@
2340
{...linkProps}
2441
data-sveltekit-preload-data
2542
{...$$restProps}
43+
style="background: {randomGradientBackground};"
2644
>
27-
{#if $$slots.image || backgroundImage}
28-
<div class="image" style="background-image: url({backgroundImage});">
29-
<slot name="image" />
30-
</div>
31-
{/if}
3245
<div class="body">
3346
<div class="content">
3447
<slot name="content" />

src/lib/components/molecules/BlogPostCard.svelte

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script lang="ts">
22
import Cards from '$lib/components/atoms/Cards.svelte';
3-
import Image from '$lib/components/atoms/Image.svelte';
43
import { formatDate } from '$lib/utils/date';
54
65
export let title: string;
@@ -15,15 +14,10 @@
1514
</script>
1615

1716
<Cards
18-
href="/{slug}"
17+
href={`/${slug}`}
1918
target="_self"
2019
additionalClass="blog-post-card {!showImage || !coverImage ? 'no-image' : ''}"
2120
>
22-
<div class="image" slot="image">
23-
{#if coverImage}
24-
<Image src={coverImage} alt="Cover image of this blog post" />
25-
{/if}
26-
</div>
2721
<div class="content" slot="content">
2822
<h3 class="title">
2923
{title}

src/lib/components/singletons/RecentPosts.svelte

-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
<BlogPostCard
1212
slug={post.slug}
1313
title={post.title}
14-
showImage={true}
1514
date={post.date}
1615
contributor={post.contributor}
17-
coverImage={post.coverImage}
1816
/>
1917
{/each}
2018
</div>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/routes/(waves)/404/+page.svelte

-41
This file was deleted.

src/routes/+layout.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<Header />
88
<div>
9-
<slot></slot>
9+
<slot />
1010
</div>
1111
<Footer />
1212

File renamed without changes.
File renamed without changes.

svelte.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const config = {
1313
kit: {
1414
adapter: adapter(),
1515
prerender: {
16-
handleHttpError: 'warn'
16+
handleHttpError: 'warn',
17+
entries: ['*']
1718
}
1819
},
1920
preprocess: [

0 commit comments

Comments
 (0)