Skip to content

Commit

Permalink
docs: add links & metatags
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Jul 4, 2024
1 parent f9f6449 commit 0d9fa40
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 20 deletions.
2 changes: 2 additions & 0 deletions website/app/globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const siteTitle = '@pheralb/toast';
export const eslogan = 'An accessible and beautiful toast library for React';
39 changes: 36 additions & 3 deletions website/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { LinksFunction, LoaderFunctionArgs } from '@vercel/remix';
import type {
LinksFunction,
LoaderFunctionArgs,
MetaFunction,
} from '@vercel/remix';

import {
Links,
Expand All @@ -9,6 +13,7 @@ import {
useLoaderData,
} from '@remix-run/react';
import { getLatestVersion } from 'fast-npm-meta';
import { eslogan, siteTitle } from './globals';

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

// Store:
// Stores:
import { useDocsStore } from './store';

// Links:
export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: stylesheet },
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/images/logo.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/images/logo.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/images/logo.png',
},
{ rel: 'manifest', href: '/manifest.webmanifest' },
{ rel: 'icon', href: '/images/logo_ico.ico' },
];

// Metadata:
export const meta: MetaFunction = ({ matches }) => {
const parentMeta = matches
.flatMap((match) => match.meta ?? [])
.filter((meta) => !('title' in meta));
return [...parentMeta, { title: `${eslogan} | ${siteTitle}` }];
};

export async function loader({ request }: LoaderFunctionArgs) {
const { getTheme } = await themeSessionResolver(request);
const metadata = await getLatestVersion('@pheralb/toast');
Expand Down Expand Up @@ -79,7 +112,7 @@ function App() {
>
<ToastProvider
position={toastPosition}
theme={toastTheme ? toastTheme : theme!}
theme={toastTheme ?? theme!}
toastFont="font-sans"
>
<Header />
Expand Down
8 changes: 1 addition & 7 deletions website/app/routes/_index.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
export const meta = [
{
title: 'Getting Started',
description: 'How to use @pheralb/toast library with Next.js',
},
];

import Hero from '../components/hero';
import Usage from '../components/usage';
import { siteTitle } from '../globals.ts';

<Hero />

Expand Down
4 changes: 3 additions & 1 deletion website/app/routes/nextjs.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { siteTitle } from '../globals.ts';

export const meta = [
{
title: 'Usage with Next.js',
title: `Usage with Next.js | ${siteTitle}`,
description: 'How to use @pheralb/toast library with Next.js',
},
];
Expand Down
7 changes: 4 additions & 3 deletions website/app/routes/provider.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Positions, Theme } from '../components/examples/provider';
import { siteTitle } from '../globals.ts';

export const meta = [
{
title: 'Toast Provider',
title: `Toast Provider | ${siteTitle}`,
description: 'How to use the ToastProvider component in your application',
},
];

import { Positions, Theme } from '../components/examples/provider';

# Toast Provider

The `<ToastProvider />` component is used to wrap your application and provide the context for the toasts. It accepts the following props:
Expand Down
13 changes: 7 additions & 6 deletions website/app/routes/useToast.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {
UseToastVariantExamples,
UseToastActionsExamples,
} from '../components/examples/useToast';
import { siteTitle } from '../globals.ts';

export const meta = [
{
title: 'useToast',
title: `useToast | ${siteTitle}`,
description:
'How to use the useToast hook in your application to render toasts',
},
];

import {
UseToastVariantExamples,
UseToastActionsExamples,
} from '../components/examples/useToast';

# useToast

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

0 comments on commit 0d9fa40

Please sign in to comment.