Initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { homepageContent } from '$lib/content/homepage';
|
||||
import { staticPages, type StaticPageSlug } from '$lib/content/static-pages';
|
||||
|
||||
export const sharedPageContent = {
|
||||
navigation: homepageContent.navigation,
|
||||
services: homepageContent.services,
|
||||
testimonials: homepageContent.testimonials,
|
||||
booking: homepageContent.booking,
|
||||
footer: homepageContent.footer
|
||||
};
|
||||
|
||||
export function createHomepageRouteData() {
|
||||
return {
|
||||
content: homepageContent
|
||||
};
|
||||
}
|
||||
|
||||
export function createStaticRouteData(slug: StaticPageSlug) {
|
||||
return {
|
||||
content: sharedPageContent,
|
||||
page: staticPages[slug],
|
||||
slug
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type MockPageStoreValue = {
|
||||
url: URL;
|
||||
params: Record<string, string>;
|
||||
route: {
|
||||
id: string | null;
|
||||
};
|
||||
status: number;
|
||||
error: App.Error | null;
|
||||
data: Record<string, unknown>;
|
||||
form: Record<string, unknown> | null;
|
||||
state: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export function createMockPage(
|
||||
url = 'https://www.goodwalk.co.nz/',
|
||||
overrides: Partial<MockPageStoreValue> = {}
|
||||
): MockPageStoreValue {
|
||||
return {
|
||||
url: new URL(url),
|
||||
params: {},
|
||||
route: { id: null },
|
||||
status: 200,
|
||||
error: null,
|
||||
data: {},
|
||||
form: null,
|
||||
state: {},
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
export const pageStore = writable<MockPageStoreValue>(createMockPage());
|
||||
export const navigatingStore = writable<null>(null);
|
||||
const updatedWritable = writable(false);
|
||||
|
||||
export const updatedStore = {
|
||||
subscribe: updatedWritable.subscribe,
|
||||
check: async () => false
|
||||
};
|
||||
|
||||
export function setMockPage(url: string, overrides: Partial<MockPageStoreValue> = {}) {
|
||||
pageStore.set(createMockPage(url, overrides));
|
||||
}
|
||||
|
||||
export function resetMockPage() {
|
||||
pageStore.set(createMockPage());
|
||||
}
|
||||
Reference in New Issue
Block a user