Skip to content

Commit 82a4d16

Browse files
committed
docs(storybook): add stories for EuiOutsideClickDetector
- renaming of component file to ensure props are read by Storybook
1 parent bbe232e commit 82a4d16

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
import React from 'react';
10+
import type { Meta, StoryObj } from '@storybook/react';
11+
12+
import { EuiText } from '../text';
13+
import {
14+
EuiOutsideClickDetector,
15+
EuiOutsideClickDetectorProps,
16+
} from './outside_click_detector';
17+
18+
const meta: Meta<EuiOutsideClickDetectorProps> = {
19+
title: 'Utilities/EuiOutsideClickDetector',
20+
component: EuiOutsideClickDetector,
21+
};
22+
23+
export default meta;
24+
type Story = StoryObj<EuiOutsideClickDetectorProps>;
25+
26+
export const Playground: Story = {
27+
args: {
28+
children: (
29+
<EuiText>
30+
<p>Click anywhere outside of this text to trigger an alert</p>
31+
</EuiText>
32+
),
33+
onOutsideClick: () => {
34+
window.alert('Clicked outside');
35+
},
36+
},
37+
render: (args) => <EuiOutsideClickDetector {...args} />,
38+
};

src/components/outside_click_detector/outside_click_detector.ts renamed to src/components/outside_click_detector/outside_click_detector.tsx

File renamed without changes.

0 commit comments

Comments
 (0)