mirror of
https://github.com/BradNut/personal-website-sveltekit
synced 2025-09-08 23:20:18 +00:00
Ran svelte 5 upgrade script.
This commit is contained in:
parent
4aa41b3817
commit
daada71365
12 changed files with 203 additions and 90 deletions
|
|
@ -1,20 +1,34 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import OpenInNew from '@iconify-icons/mdi/open-in-new';
|
import OpenInNew from '@iconify-icons/mdi/open-in-new';
|
||||||
import type { IconifyIcon } from 'iconify-icon';
|
import type { IconifyIcon } from 'iconify-icon';
|
||||||
export let rel = 'noreferrer';
|
interface Props {
|
||||||
export let target = '_blank';
|
rel?: string;
|
||||||
export let href: string;
|
target?: string;
|
||||||
export let ariaLabel: string;
|
href: string;
|
||||||
export let showIcon: boolean = false;
|
ariaLabel: string;
|
||||||
export let clazz = "";
|
showIcon?: boolean;
|
||||||
export let icon: IconifyIcon = OpenInNew;
|
clazz?: string;
|
||||||
|
icon?: IconifyIcon;
|
||||||
|
children?: import('svelte').Snippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
rel = 'noreferrer',
|
||||||
|
target = '_blank',
|
||||||
|
href,
|
||||||
|
ariaLabel,
|
||||||
|
showIcon = false,
|
||||||
|
clazz = "",
|
||||||
|
icon = OpenInNew,
|
||||||
|
children
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<a class:show-icon={showIcon} class={clazz} aria-label={`Open ${ariaLabel} externally`} title={`Open ${ariaLabel} externally`} {href} {rel} {target}>
|
<a class:show-icon={showIcon} class={clazz} aria-label={`Open ${ariaLabel} externally`} title={`Open ${ariaLabel} externally`} {href} {rel} {target}>
|
||||||
<slot />
|
{@render children?.()}
|
||||||
{#if showIcon}
|
{#if showIcon}
|
||||||
<iconify-icon {icon} width="24" height="24" role="img" title={`Open ${ariaLabel} Externally`} />
|
<iconify-icon {icon} width="24" height="24" role="img" title={`Open ${ariaLabel} Externally`}></iconify-icon>
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,24 @@
|
||||||
import Img from '@zerodevx/svelte-img';
|
import Img from '@zerodevx/svelte-img';
|
||||||
import type { ExternalImageSource } from '../types/album';
|
import type { ExternalImageSource } from '../types/album';
|
||||||
|
|
||||||
export let clazz = "";
|
interface Props {
|
||||||
export let src: Record<string, any> | ExternalImageSource[] | undefined;
|
clazz?: string;
|
||||||
export let alt: string;
|
src: Record<string, any> | ExternalImageSource[] | undefined;
|
||||||
export let style = "";
|
alt: string;
|
||||||
export let loading: "lazy" | "eager" = "lazy";
|
style?: string;
|
||||||
|
loading?: "lazy" | "eager";
|
||||||
|
}
|
||||||
|
|
||||||
let ref: any;
|
let {
|
||||||
let loaded: boolean;
|
clazz = "",
|
||||||
|
src,
|
||||||
|
alt,
|
||||||
|
style = "",
|
||||||
|
loading = "lazy"
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
|
let ref: any = $state();
|
||||||
|
let loaded: boolean = $state();
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (ref.complete) {
|
if (ref.complete) {
|
||||||
|
|
@ -21,7 +31,7 @@
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<Img class={clazz} {style} {src} {alt} {loading} bind:ref on:load={() => (loaded = true)} />
|
<Img class={clazz} {style} {src} {alt} {loading} bind:ref on:load={() => (loaded = true)} />
|
||||||
<div class:blur={loaded} class:loaded />
|
<div class:blur={loaded} class:loaded></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let rel = '';
|
interface Props {
|
||||||
export let target = '';
|
rel?: string;
|
||||||
export let href: string;
|
target?: string;
|
||||||
export let ariaLabel: string;
|
href: string;
|
||||||
|
ariaLabel: string;
|
||||||
|
children?: import('svelte').Snippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
rel = '',
|
||||||
|
target = '',
|
||||||
|
href,
|
||||||
|
ariaLabel,
|
||||||
|
children
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a aria-label={ariaLabel} {href} {rel} {target}>
|
<a aria-label={ariaLabel} {href} {rel} {target}>
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -3,32 +3,44 @@
|
||||||
import { Pagination } from "bits-ui";
|
import { Pagination } from "bits-ui";
|
||||||
import { ChevronLeft, ChevronRight } from 'lucide-svelte';
|
import { ChevronLeft, ChevronRight } from 'lucide-svelte';
|
||||||
|
|
||||||
export let additionalClasses: string;
|
interface Props {
|
||||||
export let pageSize: number;
|
additionalClasses: string;
|
||||||
export let totalCount: number;
|
pageSize: number;
|
||||||
export let currentPage: number;
|
totalCount: number;
|
||||||
export let base: string;
|
currentPage: number;
|
||||||
|
base: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
additionalClasses,
|
||||||
|
pageSize,
|
||||||
|
totalCount,
|
||||||
|
currentPage,
|
||||||
|
base
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Pagination.Root let:pages count={totalCount} perPage={pageSize} page={currentPage || 1} class={`${additionalClasses}`}
|
<Pagination.Root count={totalCount} perPage={pageSize} page={currentPage || 1} class={`${additionalClasses}`}
|
||||||
onPageChange={(page) => goto(`${base}/${page}`)}>
|
onPageChange={(page) => goto(`${base}/${page}`)}>
|
||||||
<Pagination.PrevButton>
|
{#snippet children({ pages })}
|
||||||
<ChevronLeft />
|
<Pagination.PrevButton>
|
||||||
</Pagination.PrevButton>
|
<ChevronLeft />
|
||||||
{#each pages as page (page.key)}
|
</Pagination.PrevButton>
|
||||||
{#if page.type === "ellipsis"}
|
{#each pages as page (page.key)}
|
||||||
<div class="ellipsis text-[15px] font-medium text-foreground-alt">...</div>
|
{#if page.type === "ellipsis"}
|
||||||
{:else}
|
<div class="ellipsis text-[15px] font-medium text-foreground-alt">...</div>
|
||||||
<Pagination.Page {page}>
|
{:else}
|
||||||
<a href={`${base}/${page.value}`}>
|
<Pagination.Page {page}>
|
||||||
{page.value}
|
<a href={`${base}/${page.value}`}>
|
||||||
</a>
|
{page.value}
|
||||||
</Pagination.Page>
|
</a>
|
||||||
{/if}
|
</Pagination.Page>
|
||||||
{/each}
|
{/if}
|
||||||
<Pagination.NextButton>
|
{/each}
|
||||||
<ChevronRight />
|
<Pagination.NextButton>
|
||||||
</Pagination.NextButton>
|
<ChevronRight />
|
||||||
|
</Pagination.NextButton>
|
||||||
|
{/snippet}
|
||||||
</Pagination.Root>
|
</Pagination.Root>
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,26 @@
|
||||||
siteUrl,
|
siteUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
export let title = defaultMetadata.defaultTitle;
|
interface Props {
|
||||||
export let description = defaultMetadata.defaultDescription;
|
title?: any;
|
||||||
export let image = defaultMetadata.defaultImage;
|
description?: any;
|
||||||
export let location: string = '';
|
image?: any;
|
||||||
|
location?: string;
|
||||||
|
}
|
||||||
|
|
||||||
$: seo = {
|
let {
|
||||||
|
title = defaultMetadata.defaultTitle,
|
||||||
|
description = defaultMetadata.defaultDescription,
|
||||||
|
image = defaultMetadata.defaultImage,
|
||||||
|
location = ''
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
|
let seo = $derived({
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
image: `${siteUrl}${image}`,
|
image: `${siteUrl}${image}`,
|
||||||
url: `${siteUrl}${location || ``}`,
|
url: `${siteUrl}${location || ``}`,
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let name: string;
|
interface Props {
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { name }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span>{name}</span>
|
<span>{name}</span>
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,25 @@
|
||||||
import linkedin from '@iconify-icons/radix-icons/linkedin-logo';
|
import linkedin from '@iconify-icons/radix-icons/linkedin-logo';
|
||||||
import twitter from '@iconify-icons/radix-icons/twitter-logo';
|
import twitter from '@iconify-icons/radix-icons/twitter-logo';
|
||||||
|
|
||||||
export let showGithub: boolean = false;
|
interface Props {
|
||||||
export let showTwitter: boolean = false;
|
showGithub?: boolean;
|
||||||
export let showLinkedIn: boolean = false;
|
showTwitter?: boolean;
|
||||||
export let showEmail: boolean = false;
|
showLinkedIn?: boolean;
|
||||||
export let userNames: Record<string, string>;
|
showEmail?: boolean;
|
||||||
export let showText: boolean = false;
|
userNames: Record<string, string>;
|
||||||
export let justify: boolean = false;
|
showText?: boolean;
|
||||||
|
justify?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
showGithub = false,
|
||||||
|
showTwitter = false,
|
||||||
|
showLinkedIn = false,
|
||||||
|
showEmail = false,
|
||||||
|
userNames,
|
||||||
|
showText = false,
|
||||||
|
justify = false
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if showText}
|
{#if showText}
|
||||||
|
|
@ -26,7 +38,7 @@
|
||||||
aria-label="Contact through Twitter"
|
aria-label="Contact through Twitter"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<iconify-icon icon={twitter} class="twitter-contact" width="24" height="24" />
|
<iconify-icon icon={twitter} class="twitter-contact" width="24" height="24"></iconify-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
@ -39,7 +51,7 @@
|
||||||
aria-label="Contact through LinkedIn"
|
aria-label="Contact through LinkedIn"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<iconify-icon icon={linkedin} class="linkedin-contact" width="24" height="24" />
|
<iconify-icon icon={linkedin} class="linkedin-contact" width="24" height="24"></iconify-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
@ -52,7 +64,7 @@
|
||||||
aria-label="View Github"
|
aria-label="View Github"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<iconify-icon icon={github} class="github-contact" width="24" height="24" />
|
<iconify-icon icon={github} class="github-contact" width="24" height="24"></iconify-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
@ -65,7 +77,7 @@
|
||||||
aria-label="Contact by email"
|
aria-label="Contact by email"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<iconify-icon icon={email} class="email-contact" width="24" height="24" />
|
<iconify-icon icon={email} class="email-contact" width="24" height="24"></iconify-icon>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let header: string;
|
interface Props {
|
||||||
export let page: string;
|
header: string;
|
||||||
export let image: string;
|
page: string;
|
||||||
export let content: string;
|
image: string;
|
||||||
export let width = 1200;
|
content: string;
|
||||||
export let height = 630;
|
width?: number;
|
||||||
export let url: string;
|
height?: number;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
header,
|
||||||
|
page,
|
||||||
|
image,
|
||||||
|
content,
|
||||||
|
width = 1200,
|
||||||
|
height = 630,
|
||||||
|
url
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="social-card" style={`width: ${width}px; height: ${height}px;`}>
|
<div class="social-card" style={`width: ${width}px; height: ${height}px;`}>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { run } from 'svelte/legacy';
|
||||||
|
|
||||||
import { MetaTags } from 'svelte-meta-tags';
|
import { MetaTags } from 'svelte-meta-tags';
|
||||||
import NProgress from "nprogress";
|
import NProgress from "nprogress";
|
||||||
import 'iconify-icon';
|
import 'iconify-icon';
|
||||||
|
|
@ -10,6 +12,11 @@
|
||||||
import Header from '$lib/components/header/index.svelte';
|
import Header from '$lib/components/header/index.svelte';
|
||||||
import Footer from '$lib/components/footer/index.svelte';
|
import Footer from '$lib/components/footer/index.svelte';
|
||||||
import Analytics from '$lib/components/analytics/index.svelte';
|
import Analytics from '$lib/components/analytics/index.svelte';
|
||||||
|
interface Props {
|
||||||
|
children?: import('svelte').Snippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { children }: Props = $props();
|
||||||
|
|
||||||
NProgress.configure({
|
NProgress.configure({
|
||||||
// Full list: https://github.com/rstacruz/nprogress#configuration
|
// Full list: https://github.com/rstacruz/nprogress#configuration
|
||||||
|
|
@ -19,15 +26,15 @@
|
||||||
const dev = process.env.NODE_ENV !== 'production';
|
const dev = process.env.NODE_ENV !== 'production';
|
||||||
const siteUrl = PUBLIC_SITE_URL || 'https://bradleyshellnut.com/';
|
const siteUrl = PUBLIC_SITE_URL || 'https://bradleyshellnut.com/';
|
||||||
|
|
||||||
$: {
|
|
||||||
if (browser && $navigating) {
|
if (browser && $navigating) {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
} else {
|
} else {
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: metaTags = {
|
let metaTags = $derived({
|
||||||
titleTemplate: '%s | Bradley Shellnut',
|
titleTemplate: '%s | Bradley Shellnut',
|
||||||
additionalMetaTags: [
|
additionalMetaTags: [
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +43,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
...$page.data.metaTagsChild
|
...$page.data.metaTagsChild
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !dev}
|
{#if !dev}
|
||||||
|
|
@ -48,7 +55,7 @@
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<Header />
|
<Header />
|
||||||
<main>
|
<main>
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@
|
||||||
import Tag from "$lib/components/Tag.svelte";
|
import Tag from "$lib/components/Tag.svelte";
|
||||||
import type { Course } from "$lib/types/courses";
|
import type { Course } from "$lib/types/courses";
|
||||||
|
|
||||||
export let course: Course;
|
interface Props {
|
||||||
|
course: Course;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { course }: Props = $props();
|
||||||
const { externalLinks, tags } = course;
|
const { externalLinks, tags } = course;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { IconifyIcon } from "iconify-icon/dist/iconify-icon.js";
|
import type { IconifyIcon } from "iconify-icon/dist/iconify-icon.js";
|
||||||
|
|
||||||
export let ariaLabel: string;
|
interface Props {
|
||||||
export let href: string;
|
ariaLabel: string;
|
||||||
export let clazz = "";
|
href: string;
|
||||||
export let itemText: string;
|
clazz?: string;
|
||||||
export let icon: IconifyIcon;
|
itemText: string;
|
||||||
|
icon: IconifyIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
ariaLabel,
|
||||||
|
href,
|
||||||
|
clazz = "",
|
||||||
|
itemText,
|
||||||
|
icon
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
|
|
@ -15,7 +25,7 @@
|
||||||
{href}
|
{href}
|
||||||
class={clazz}
|
class={clazz}
|
||||||
>
|
>
|
||||||
<iconify-icon {icon} width="24" height="24" role="img" title={itemText} />
|
<iconify-icon {icon} width="24" height="24" role="img" title={itemText}></iconify-icon>
|
||||||
<p>{itemText}</p>
|
<p>{itemText}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,26 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { run } from 'svelte/legacy';
|
||||||
|
|
||||||
import Pagination from '$lib/components/Pagination.svelte';
|
import Pagination from '$lib/components/Pagination.svelte';
|
||||||
import type { Article } from '$lib/types/article';
|
import type { Article } from '$lib/types/article';
|
||||||
import Articles from '$lib/components/Articles.svelte';
|
import Articles from '$lib/components/Articles.svelte';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
export let data: PageData;
|
interface Props {
|
||||||
let articles: Article[];
|
data: PageData;
|
||||||
let currentPage: number;
|
|
||||||
let totalArticles: number;
|
|
||||||
let limit: number;
|
|
||||||
|
|
||||||
$: if (data) {
|
|
||||||
({ articles, currentPage, totalArticles, limit } = data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let { data }: Props = $props();
|
||||||
|
let articles: Article[] = $state();
|
||||||
|
let currentPage: number = $state();
|
||||||
|
let totalArticles: number = $state();
|
||||||
|
let limit: number = $state();
|
||||||
|
|
||||||
|
run(() => {
|
||||||
|
if (data) {
|
||||||
|
({ articles, currentPage, totalArticles, limit } = data);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1 style:margin-bottom={"2rem"}>Favorite Tech Articles</h1>
|
<h1 style:margin-bottom={"2rem"}>Favorite Tech Articles</h1>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue