Skip to content

Commit

Permalink
Add stroy testing view customization
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Jul 10, 2024
1 parent d1b4893 commit 213badd
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/stories/Custom.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { HydraAdmin } from '../hydra';
import ResourceGuesser from '../core/ResourceGuesser';
import ListGuesser from '../list/ListGuesser';
import ShowGuesser from '../show/ShowGuesser';
import FieldGuesser from '../field/FieldGuesser';
import EditGuesser from '../edit/EditGuesser';
import InputGuesser from '../input/InputGuesser';
import CreateGuesser from '../create/CreateGuesser';

export default {
title: 'Admin/Custom',
parameters: {
layout: 'fullscreen',
},
};

const GreetingList = () => (
<ListGuesser>
<FieldGuesser source="name" label="Identity" />
</ListGuesser>
);

const GreetingShow = () => (
<ShowGuesser>
<FieldGuesser source="name" label="Identity" />
</ShowGuesser>
);

const GreetingEdit = () => (
<EditGuesser>
<InputGuesser source="name" label="Identity" />
</EditGuesser>
);

const GreetingCreate = () => (
<CreateGuesser>
<InputGuesser source="name" label="Identity" />
</CreateGuesser>
);

export const Custom = () => (
<HydraAdmin entrypoint={process.env.ENTRYPOINT}>
<ResourceGuesser
name="greetings"
options={{ label: 'Salutation' }}
list={GreetingList}
show={GreetingShow}
edit={GreetingEdit}
create={GreetingCreate}
/>
</HydraAdmin>
);

0 comments on commit 213badd

Please sign in to comment.