Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exmaple to to latest remix version / vite config #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,47 @@
// Import the base CSS styles for the radix-ui components.
import '@radix-ui/themes/styles.css';
import { Theme, Card, Container, Flex, Button, Box } from '@radix-ui/themes';
import "@radix-ui/themes/styles.css";
import { Theme, Card, Container, Flex, Button, Box } from "@radix-ui/themes";

import { cssBundleHref } from '@remix-run/css-bundle';
import type {
ActionFunctionArgs,
LinksFunction,
LoaderFunctionArgs,
} from '@remix-run/node';
} from "@remix-run/node";

import {
Links,
Link,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useRouteLoaderData,
json,
} from '@remix-run/react';
} from "@remix-run/react";

import Footer from './components/footer';
import SignInButton from './components/sign-in-button';
import Footer from "./components/footer";
import SignInButton from "./components/sign-in-button";

import {
getSignInUrl,
signOut,
authkitLoader,
} from '@workos-inc/authkit-remix';
} from "@workos-inc/authkit-remix";

export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : []),
];
export const links: LinksFunction = () => [];

export const loader = (args: LoaderFunctionArgs) =>
authkitLoader(
args,
async () => {
return json({
return {
signInUrl: await getSignInUrl(),
});
};
},
{ debug: true }
);

export function useRootLoaderData() {
return useRouteLoaderData<typeof loader>('root');
return useRouteLoaderData<typeof loader>("root");
}

export async function action({ request }: ActionFunctionArgs) {
Expand All @@ -65,13 +61,12 @@ export default function App() {
<body>
<ScrollRestoration />
<Scripts />
<LiveReload />
<Theme
accentColor="iris"
panelBackground="solid"
style={{ backgroundColor: 'var(--gray-1)' }}
style={{ backgroundColor: "var(--gray-1)" }}
>
<Container style={{ backgroundColor: 'var(--gray-1)' }}>
<Container style={{ backgroundColor: "var(--gray-1)" }}>
<Flex direction="column" gap="5" p="5" height="100vh">
<Box asChild flexGrow="1">
<Card size="4">
Expand All @@ -84,7 +79,7 @@ export default function App() {
</Button>

<Button asChild variant="soft">
<Link to="/account">Account</Link>
<Link to="./account">Account</Link>
</Button>
</Flex>

Expand Down
20 changes: 10 additions & 10 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { ActionFunctionArgs, MetaFunction } from '@remix-run/node';
import { Button, Flex, Heading, Text } from '@radix-ui/themes';
import { Link } from '@remix-run/react';
import SignInButton from '~/components/sign-in-button';
import { useRootLoaderData } from '~/root';
import { signOut } from '@workos-inc/authkit-remix';
import type { ActionFunctionArgs, MetaFunction } from "@remix-run/node";
import { Button, Flex, Heading, Text } from "@radix-ui/themes";
import { Link } from "@remix-run/react";
import SignInButton from "~/components/sign-in-button";
import { useRootLoaderData } from "~/root";
import { signOut } from "@workos-inc/authkit-remix";

export const meta: MetaFunction = () => {
return [
{ title: 'Example AuthKit Authenticated App' },
{ title: "Example AuthKit Authenticated App" },
{
name: 'description',
content: 'Example Remix application demonstrating how to use AuthKit.',
name: "description",
content: "Example Remix application demonstrating how to use AuthKit.",
},
];
};
Expand All @@ -36,7 +36,7 @@ export default function Index() {
</Text>
<Flex align="center" gap="3" mt="4">
<Button asChild size="3" variant="soft">
<Link to="/account">View account</Link>
<Link to="./account">View account</Link>
</Button>
<SignInButton large />
</Flex>
Expand Down
Loading