import * as React from 'react'; import { DefaultButton, Callout, DirectionalHint, Dropdown, IDropdownOption, Checkbox, Slider, getTheme, mergeStyleSets, FontWeights, Link, Text, } from 'office-ui-fabric-react'; import { useBoolean, useId } from '@uifabric/react-hooks'; const DIRECTION_OPTIONS = [ { key: DirectionalHint.topLeftEdge, text: 'Top Left Edge' }, { key: DirectionalHint.topCenter, text: 'Top Center' }, { key: DirectionalHint.topRightEdge, text: 'Top Right Edge' }, { key: DirectionalHint.topAutoEdge, text: 'Top Auto Edge' }, { key: DirectionalHint.bottomLeftEdge, text: 'Bottom Left Edge' }, { key: DirectionalHint.bottomCenter, text: 'Bottom Center' }, { key: DirectionalHint.bottomRightEdge, text: 'Bottom Right Edge' }, { key: DirectionalHint.bottomAutoEdge, text: 'Bottom Auto Edge' }, { key: DirectionalHint.leftTopEdge, text: 'Left Top Edge' }, { key: DirectionalHint.leftCenter, text: 'Left Center' }, { key: DirectionalHint.leftBottomEdge, text: 'Left Bottom Edge' }, { key: DirectionalHint.rightTopEdge, text: 'Right Top Edge' }, { key: DirectionalHint.rightCenter, text: 'Right Center' }, { key: DirectionalHint.rightBottomEdge, text: 'Right Bottom Edge' }, ]; const theme = getTheme(); const checkBoxStyles = { root: { margin: '10px 0' } }; const styles = mergeStyleSets({ buttonArea: { verticalAlign: 'top', display: 'inline-block', textAlign: 'center', margin: '0 100px', minWidth: 130, height: 32, }, configArea: { minWidth: '300px', display: 'inline-block', }, callout: { maxWidth: 300, }, calloutExampleButton: { width: '100%', }, header: { padding: '18px 24px 12px', }, title: [ { margin: 0, fontWeight: FontWeights.semilight, }, ], inner: { height: '100%', padding: '0 24px 20px', }, subtext: [ { margin: 0, fontWeight: FontWeights.semilight, }, ], link: [ theme.fonts.medium, { color: theme.palette.neutralPrimary, }, ], actions: { position: 'relative', marginTop: 20, width: '100%', whiteSpace: 'nowrap', }, }); export const CalloutDirectionalExample: React.FunctionComponent = () => { const [isCalloutVisible, { toggle: toggleIsCalloutVisible }] = useBoolean(false); const [isBeakVisible, { toggle: toggleIsBeakVisible }] = useBoolean(true); const [gapSpace, setGapSpace] = React.useState(); const [beakWidth, setBeakWidth] = React.useState(); const labelId: string = useId('callout-label'); const descriptionId: string = useId('callout-description'); const [directionalHint, setDirectionalHint] = React.useState(DirectionalHint.bottomLeftEdge); const onDirectionalChanged = (event: React.FormEvent, option: IDropdownOption): void => { setDirectionalHint(option.key as DirectionalHint); }; const onGapSliderChange = (value: number): void => { setGapSpace(value); }; const onBeakWidthSliderChange = (value: number): void => { setBeakWidth(value); }; const onShowBeakChange = () => { toggleIsBeakVisible(); setBeakWidth(10); }; return ( <>
{/* eslint-disable react/jsx-no-bind */} {isBeakVisible && ( )} {/* eslint-enable react/jsx-no-bind */}
{isCalloutVisible ? (
All of your favorite people
Message body is optional. If help documentation is available, consider adding a link to learn more at the bottom.
Go to Microsoft
) : null} ); };