forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFocusTrapZone.PropValues.stories.tsx
More file actions
31 lines (29 loc) · 1.04 KB
/
FocusTrapZone.PropValues.stories.tsx
File metadata and controls
31 lines (29 loc) · 1.04 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
import * as React from 'react';
import { FocusTrapZone } from '@fluentui/react';
import type { IFocusTrapZoneProps } from '@fluentui/react';
import { useProps } from '../../../e2e/utils';
import { rootClass } from './shared';
/** Respects default and explicit prop values */
export const PropValues = () => {
const [buttonClicked, setButtonClicked] = React.useState('');
const props = useProps<IFocusTrapZoneProps>();
return (
// don't render until props have been set
props && (
<div className={rootClass} onClick={ev => setButtonClicked((ev.target as HTMLButtonElement).textContent || '')}>
<span id="buttonClicked" style={{ display: 'block' /* avoid inherited div styling */ }}>
clicked {buttonClicked}
</span>
<button>before</button>
<FocusTrapZone {...props}>
<button>first</button>
<button>mid</button>
<button className="last-class" id="last">
last
</button>
</FocusTrapZone>
<button>after</button>
</div>
)
);
};