Skip to content

Commit 0d9fa40

Browse files
committed
docs: add links & metatags
1 parent f9f6449 commit 0d9fa40

File tree

6 files changed

+53
-20
lines changed

6 files changed

+53
-20
lines changed

website/app/globals.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const siteTitle = '@pheralb/toast';
2+
export const eslogan = 'An accessible and beautiful toast library for React';

website/app/root.tsx

+36-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { LinksFunction, LoaderFunctionArgs } from '@vercel/remix';
1+
import type {
2+
LinksFunction,
3+
LoaderFunctionArgs,
4+
MetaFunction,
5+
} from '@vercel/remix';
26

37
import {
48
Links,
@@ -9,6 +13,7 @@ import {
913
useLoaderData,
1014
} from '@remix-run/react';
1115
import { getLatestVersion } from 'fast-npm-meta';
16+
import { eslogan, siteTitle } from './globals';
1217

1318
// Styles:
1419
import stylesheet from '@/styles/globals.css?url';
@@ -32,13 +37,41 @@ import { themeSessionResolver } from './sessions.server';
3237
import { MDXProvider } from '@mdx-js/react';
3338
import { mdxComponents } from './components/mdx';
3439

35-
// Store:
40+
// Stores:
3641
import { useDocsStore } from './store';
3742

43+
// Links:
3844
export const links: LinksFunction = () => [
3945
{ rel: 'stylesheet', href: stylesheet },
46+
{
47+
rel: 'apple-touch-icon',
48+
sizes: '180x180',
49+
href: '/images/logo.png',
50+
},
51+
{
52+
rel: 'icon',
53+
type: 'image/png',
54+
sizes: '32x32',
55+
href: '/images/logo.png',
56+
},
57+
{
58+
rel: 'icon',
59+
type: 'image/png',
60+
sizes: '16x16',
61+
href: '/images/logo.png',
62+
},
63+
{ rel: 'manifest', href: '/manifest.webmanifest' },
64+
{ rel: 'icon', href: '/images/logo_ico.ico' },
4065
];
4166

67+
// Metadata:
68+
export const meta: MetaFunction = ({ matches }) => {
69+
const parentMeta = matches
70+
.flatMap((match) => match.meta ?? [])
71+
.filter((meta) => !('title' in meta));
72+
return [...parentMeta, { title: `${eslogan} | ${siteTitle}` }];
73+
};
74+
4275
export async function loader({ request }: LoaderFunctionArgs) {
4376
const { getTheme } = await themeSessionResolver(request);
4477
const metadata = await getLatestVersion('@pheralb/toast');
@@ -79,7 +112,7 @@ function App() {
79112
>
80113
<ToastProvider
81114
position={toastPosition}
82-
theme={toastTheme ? toastTheme : theme!}
115+
theme={toastTheme ?? theme!}
83116
toastFont="font-sans"
84117
>
85118
<Header />

website/app/routes/_index.mdx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
export const meta = [
2-
{
3-
title: 'Getting Started',
4-
description: 'How to use @pheralb/toast library with Next.js',
5-
},
6-
];
7-
81
import Hero from '../components/hero';
92
import Usage from '../components/usage';
3+
import { siteTitle } from '../globals.ts';
104

115
<Hero />
126

website/app/routes/nextjs.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { siteTitle } from '../globals.ts';
2+
13
export const meta = [
24
{
3-
title: 'Usage with Next.js',
5+
title: `Usage with Next.js | ${siteTitle}`,
46
description: 'How to use @pheralb/toast library with Next.js',
57
},
68
];

website/app/routes/provider.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { Positions, Theme } from '../components/examples/provider';
2+
import { siteTitle } from '../globals.ts';
3+
14
export const meta = [
25
{
3-
title: 'Toast Provider',
6+
title: `Toast Provider | ${siteTitle}`,
47
description: 'How to use the ToastProvider component in your application',
58
},
69
];
710

8-
import { Positions, Theme } from '../components/examples/provider';
9-
1011
# Toast Provider
1112

1213
The `<ToastProvider />` component is used to wrap your application and provide the context for the toasts. It accepts the following props:

website/app/routes/useToast.mdx

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import {
2+
UseToastVariantExamples,
3+
UseToastActionsExamples,
4+
} from '../components/examples/useToast';
5+
import { siteTitle } from '../globals.ts';
6+
17
export const meta = [
28
{
3-
title: 'useToast',
9+
title: `useToast | ${siteTitle}`,
410
description:
511
'How to use the useToast hook in your application to render toasts',
612
},
713
];
814

9-
import {
10-
UseToastVariantExamples,
11-
UseToastActionsExamples,
12-
} from '../components/examples/useToast';
13-
1415
# useToast
1516

1617
Call `useToast` to create a toast from anywhere in your React application. Make sure you add the [`<ToastProvider />`](/provider) provider to your app first.

0 commit comments

Comments
 (0)