-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove.stories.tsx
More file actions
52 lines (46 loc) · 1.08 KB
/
remove.stories.tsx
File metadata and controls
52 lines (46 loc) · 1.08 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
51
52
import type { Meta } from '@storybook/react-vite';
import {
RoiContainer,
RoiList,
RoiProvider,
TargetImage,
useActions,
useRoiState,
} from '../../src/index.ts';
import { CommittedRoisButton } from '../utils/CommittedRoisButton.tsx';
import { Layout } from '../utils/Layout.tsx';
import { getInitialRois } from '../utils/initialRois.ts';
export default {
title: 'Actions',
} as Meta;
export function RemoveROI() {
function RemoveButton() {
const { selectedRoi } = useRoiState();
const { removeRoi } = useActions();
return (
<button
type="button"
onClick={() => {
if (selectedRoi) {
removeRoi(selectedRoi);
}
}}
>
Remove ROI
</button>
);
}
return (
<RoiProvider initialConfig={{ rois: getInitialRois(320, 320) }}>
<Layout>
<RemoveButton />
<RoiContainer
target={<TargetImage id="story-image" src="/barbara.jpg" />}
>
<RoiList />
</RoiContainer>
<CommittedRoisButton />
</Layout>
</RoiProvider>
);
}