Create index
This commit is contained in:
38
apps/web/src/lib/common/seo.ts
Normal file
38
apps/web/src/lib/common/seo.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { ComponentProps } from "svelte";
|
||||
import type SvelteSeo from "svelte-seo";
|
||||
|
||||
import deepmerge from "deepmerge";
|
||||
|
||||
export type Seo = ComponentProps<SvelteSeo>;
|
||||
|
||||
export const defaultSeo: Seo = {
|
||||
title: "cannorin.net",
|
||||
description: "cannorin's website",
|
||||
themeColor: "#fafafa",
|
||||
|
||||
openGraph: {
|
||||
title: "cannorin.net",
|
||||
type: "website",
|
||||
description: "cannorin's website",
|
||||
locale: "ja_JP",
|
||||
},
|
||||
|
||||
twitter: {
|
||||
title: "cannorin.net",
|
||||
description: "cannorin's website",
|
||||
card: "summary",
|
||||
creator: "cannorin3",
|
||||
},
|
||||
};
|
||||
|
||||
export const mergeSeo = (
|
||||
target: Seo,
|
||||
...sources: (Seo | undefined | false)[]
|
||||
) =>
|
||||
sources.reduce<Seo>(
|
||||
(acc, current) =>
|
||||
deepmerge(acc, current || {}, {
|
||||
arrayMerge: (_target, source) => source,
|
||||
}),
|
||||
target,
|
||||
);
|
||||
2
apps/web/src/lib/constants.ts
Normal file
2
apps/web/src/lib/constants.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const limitWidth =
|
||||
"mx-auto w-full lg:max-w-[904px] xl:max-w-[1264px] px-6 lg:px-8";
|
||||
45
apps/web/src/lib/global.d.ts
vendored
Normal file
45
apps/web/src/lib/global.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
interface String {
|
||||
concat<S extends string>(string: S): `${this}${S}`;
|
||||
concat<S1 extends string, S2 extends string>(
|
||||
s1: S1,
|
||||
s2: S2,
|
||||
): `${this}${S1}${S2}`;
|
||||
startsWith<S extends string>(searchString: S): this is `${S}${string}`;
|
||||
endsWith<S extends string>(searchString: S): this is `${string}${S}`;
|
||||
includes<S extends string>(
|
||||
searchString: S,
|
||||
position?: number,
|
||||
): this is `${string}${S}${string}`;
|
||||
}
|
||||
|
||||
type LiteralUnionLike<T> = T extends string
|
||||
? T extends ""
|
||||
? T
|
||||
: T extends `${T}${T}`
|
||||
? never
|
||||
: T
|
||||
: T extends number
|
||||
? `${T}0` extends `${number}`
|
||||
? T
|
||||
: never
|
||||
: T extends null | undefined
|
||||
? T
|
||||
: never;
|
||||
|
||||
interface Array<T> {
|
||||
includes(
|
||||
searchElement: T extends LiteralUnionLike<T> ? unknown : never,
|
||||
fromIndex?: number,
|
||||
): searchElement is T extends LiteralUnionLike<T> ? T : never;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
includes(
|
||||
searchElement: T extends LiteralUnionLike<T> ? unknown : never,
|
||||
fromIndex?: number,
|
||||
): searchElement is T extends LiteralUnionLike<T> ? T : never;
|
||||
}
|
||||
|
||||
interface Map<K> {
|
||||
has(key: Weaken<K>): key is K;
|
||||
}
|
||||
@@ -1 +1,7 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
export function tryOneOf<const T>(
|
||||
value: T extends LiteralUnionLike<T> ? unknown : never,
|
||||
consts: readonly T[],
|
||||
) {
|
||||
if (consts.includes(value)) return value;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
6
apps/web/src/lib/utils.ts
Normal file
6
apps/web/src/lib/utils.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
Reference in New Issue
Block a user