Skip to content

Commit

Permalink
chore: add Storybook documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
adguernier committed Apr 8, 2024
1 parent 73e279d commit 8917e12
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/stories/Basic.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { HydraAdmin, type HydraAdminProps } from '../hydra';

/**
* # Basic `<HydraAdmin>` component
* The `<HydraAdmin>` component without any parameter.
*/
const Basic = ({ entrypoint }: BasicProps) => (
<HydraAdmin entrypoint={entrypoint} />
);
Expand Down
6 changes: 6 additions & 0 deletions src/stories/auth/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import React from 'react';
import { HydraAdmin, type HydraAdminProps } from '../../hydra';
import authProvider from './basicAuth';

/**
* # Pretected `<HydraAdmin>`
* The `<HydraAdmin>` component protected by the `authProvider` which is a basic authentication provider.
*
* Login with: john/123
*/
const Admin = ({ entrypoint }: JwtAuthProps) => (
<HydraAdmin entrypoint={entrypoint} authProvider={authProvider} requireAuth />
);
Expand Down
16 changes: 16 additions & 0 deletions src/stories/auth/Auth.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Canvas, Meta } from '@storybook/blocks';

import * as AuthStories from './Auth.stories';

<Meta of={AuthStories} />

# Protected HydraAdmin

The `<HydraAdmin>` component protected by the `authProvider` which is a basic authentication provider.

> Login with: **john** / **123**
See the [React-admin documentation](https://marmelab.com/react-admin/Authentication.html) to learn more.

<Canvas of={AuthStories.Loggedin} />

1 change: 0 additions & 1 deletion src/stories/auth/Auth.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Admin from './Admin';
const meta = {
title: 'Admin/Auth',
component: Admin,
tags: ['autodocs'],
parameters: {
layout: 'fullscreen',
},
Expand Down

0 comments on commit 8917e12

Please sign in to comment.