Skip to content

Commit

Permalink
docs(tutorial): move login to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
aliemir committed Feb 13, 2024
1 parent e7e78bb commit 6065450
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions documentation/tutorial/authentication/logging-in-out/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

// highlight-next-line
import { Login } from "./components/login";
import { Login } from "./pages/login";

export default function App(): JSX.Element {
return (
Expand All @@ -109,9 +109,9 @@ export default function App(): JSX.Element {

Finally, we'll import `useLogin` hook and use it inside our `Login` component to login our users.

Try to add the following lines to your `src/components/login.tsx` file:
Try to add the following lines to your `src/pages/login.tsx` file:

```tsx title="src/components/login.tsx"
```tsx title="src/pages/login.tsx"
import React from "react";
// highlight-next-line
import { useLogin } from "@refinedev/core";
Expand Down Expand Up @@ -239,7 +239,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
// highlight-next-line
import { Header } from "./components/header";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
export default function App(): JSX.Element {
return (
Expand Down Expand Up @@ -220,7 +220,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
export default function App(): JSX.Element {
Expand Down Expand Up @@ -293,14 +293,14 @@ export const CreateLoginComponentFile = () => {
<TutorialCreateFileButton
onClick={() => {
sandpack.addFile({
"src/components/login.tsx": {
"src/pages/login.tsx": {
code: LoginComponentBase,
},
});
sandpack.openFile("src/components/login.tsx");
sandpack.setActiveFile("src/components/login.tsx");
sandpack.openFile("src/pages/login.tsx");
sandpack.setActiveFile("src/pages/login.tsx");
}}
name="src/components/login.tsx"
name="src/pages/login.tsx"
/>
);
};
Expand All @@ -325,10 +325,10 @@ export const AddUseLoginToLoginComponent = () => {
<TutorialUpdateFileButton
onClick={() => {
sandpack.updateFile(
"src/components/login.tsx",
"src/pages/login.tsx",
LoginComponentWithUseLogin,
);
sandpack.setActiveFile("src/components/login.tsx");
sandpack.setActiveFile("src/pages/login.tsx");
}}
/>
);
Expand Down Expand Up @@ -408,7 +408,7 @@ export const finalFiles = {
"src/providers/auth-provider.ts": {
code: AuthProviderTsxWithLogoutMethod,
},
"src/components/login.tsx": {
"src/pages/login.tsx": {
code: LoginComponentWithUseLogin,
},
"src/components/header.tsx": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import { CreateProduct } from "./pages/products/create";
// highlight-next-line
import { ListCategories } from "./pages/categories/list";

import { Login } from "./components/login";
import { Login } from "./pages/login";

import "antd/dist/reset.css";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { CreateProduct } from "./pages/products/create";
import { ListCategories } from "./pages/categories/list";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import "antd/dist/reset.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";

export default function App(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
export default function App(): JSX.Element {
Expand Down
2 changes: 1 addition & 1 deletion documentation/tutorial/routing/intro/react-router/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";

export default function App(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
export default function App(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";

export default function App(): JSX.Element {
Expand Down Expand Up @@ -133,7 +133,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";

export default function App(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
export default function App(): JSX.Element {
Expand Down Expand Up @@ -97,7 +97,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
export default function App(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Now we've refactored our application with Ant Design, we only have one thing lef

Now let's update our `<Login />` component to use the `<AuthPage />` from `@refinedev/antd` package. This component will provide a consistent look and feel with the rest of the application.

Try to update the `src/components/login.tsx` file with the following lines:
Try to update the `src/pages/login.tsx` file with the following lines:

```tsx title="src/components/login.tsx"
```tsx title="src/pages/login.tsx"
import React from "react";
import { AuthPage } from "@refinedev/antd";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export const UseAuthPageInLogin = () => {
<TutorialUpdateFileButton
onClick={() => {
sandpack.updateFile(
"src/components/login.tsx",
"src/pages/login.tsx",
LoginTsxWithAuthPage,
);
sandpack.setActiveFile("src/components/login.tsx");
sandpack.setActiveFile("src/pages/login.tsx");
}}
/>
);
Expand All @@ -64,7 +64,7 @@ export const UseAuthPageInLogin = () => {

export const finalFiles = {
...removeActiveFromFiles(initialFiles),
"src/components/login.tsx": {
"src/pages/login.tsx": {
code: LoginTsxWithAuthPage,
active: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";

// highlight-start
Expand Down Expand Up @@ -148,7 +148,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";

import "antd/dist/reset.css";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import { Header } from "./components/header";
// We're importing a reset.css file to reset the default styles of the browser.
Expand Down Expand Up @@ -124,7 +124,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
// We're importing a reset.css file to reset the default styles of the browser.
import "antd/dist/reset.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";

import "antd/dist/reset.css";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import "antd/dist/reset.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";

import { Login } from "./components/login";
import { Login } from "./pages/login";

import "antd/dist/reset.css";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { EditProduct } from "./pages/products/edit";
import { ListProducts } from "./pages/products/list";
import { CreateProduct } from "./pages/products/create";
import { Login } from "./components/login";
import { Login } from "./pages/login";
import "antd/dist/reset.css";
Expand Down

0 comments on commit 6065450

Please sign in to comment.