-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmode.stories.tsx
More file actions
50 lines (44 loc) · 1.22 KB
/
mode.stories.tsx
File metadata and controls
50 lines (44 loc) · 1.22 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 type { Meta } from '@storybook/react-vite';
import type { ChangeEvent } from 'react';
import type { RoiMode } from '../../src/index.ts';
import {
RoiContainer,
RoiList,
RoiProvider,
TargetImage,
useActions,
} from '../../src/index.ts';
import { CommittedRoisButton } from '../utils/CommittedRoisButton.tsx';
import { Layout } from '../utils/Layout.tsx';
export default {
title: 'Actions',
} as Meta;
export function ChangeMode() {
function ChangeModeButton() {
const { setMode } = useActions();
function onChange(event: ChangeEvent<HTMLSelectElement>) {
setMode(event.target.value as RoiMode);
}
return (
<select name="select-mode" onChange={onChange}>
<option value="hybrid">Hybrid</option>
<option value="draw">Draw</option>
<option value="select">Select</option>
<option value="rotate_selected">Rotate selected</option>
</select>
);
}
return (
<RoiProvider initialConfig={{}}>
<Layout>
<ChangeModeButton />
<RoiContainer
target={<TargetImage id="story-image" src="/barbara.jpg" />}
>
<RoiList />
</RoiContainer>
<CommittedRoisButton />
</Layout>
</RoiProvider>
);
}