-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsvg_editor.stories.tsx
More file actions
50 lines (43 loc) · 1.2 KB
/
svg_editor.stories.tsx
File metadata and controls
50 lines (43 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import styled from '@emotion/styled';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
import { SvgEditor } from '../../src/index.js';
import { molecule as defaultBaseMolecule } from '../data.js';
import { OclReset } from '../reset/ocl_reset.tsx';
const defaultMolecule = defaultBaseMolecule.getCompactCopy();
defaultMolecule.setAtomCustomLabel(0, "]5'");
export default {
title: 'SvgEditor',
component: SvgEditor,
// We cannot pass a Molecule as arg because it is not serializable.
render: (args) => {
const [molecule, setMolecule] = useState(defaultMolecule);
return <SvgEditor {...args} molecule={molecule} onChange={setMolecule} />;
},
} satisfies Meta<typeof SvgEditor>;
type Story = StoryObj<typeof SvgEditor>;
export const Control: Story = {};
export const WithCssReset: Story = {
decorators: (Story) => {
return (
<>
<OclReset />
<Story />
</>
);
},
};
const Container = styled.div`
width: 300px;
overflow: hidden;
border: 1px solid black;
`;
export const InSmallWidthContainer: Story = {
decorators: (Story) => {
return (
<Container>
<Story />
</Container>
);
},
};