import * as React from 'react'; import { classNamesFunction, Coachmark, DirectionalHint, Dropdown, IDropdownOption, IStyle, TeachingBubbleContent, } from '@fluentui/react-next'; import { DefaultButton, IButtonProps } from '@fluentui/react-next/lib/compat/Button'; export interface ICoachmarkBasicExampleState { isCoachmarkVisible?: boolean; coachmarkPosition: DirectionalHint; dropdownSelectedOptionKey: string | number; } export interface ICoachmarkBasicExampleStyles { /** * Style for the root element in the default enabled/unchecked state. */ root?: IStyle; /** * The example button container */ buttonContainer: IStyle; /** * The dropdown component container */ dropdownContainer: IStyle; } export class CoachmarkBasicExample extends React.Component<{}, ICoachmarkBasicExampleState> { private _targetButton = React.createRef(); public constructor(props: {}) { super(props); this.state = { isCoachmarkVisible: false, coachmarkPosition: DirectionalHint.bottomAutoEdge, dropdownSelectedOptionKey: 'H', }; } public render(): JSX.Element { const { isCoachmarkVisible, dropdownSelectedOptionKey } = this.state; const getClassNames = classNamesFunction<{}, ICoachmarkBasicExampleStyles>(); const classNames = getClassNames(() => { return { dropdownContainer: { maxWidth: '400px', }, buttonContainer: { marginTop: '30px', display: 'inline-block', }, }; }, {}); const buttonProps: IButtonProps = { text: 'Try it', }; const buttonProps2: IButtonProps = { text: 'Try it again', }; return (
{isCoachmarkVisible && ( Welcome to the land of Coachmarks! )}
); } private _onDismiss = (): void => { this.setState({ isCoachmarkVisible: false, }); }; private _onDropdownChange = (event: React.FormEvent, option: IDropdownOption): void => { this.setState({ coachmarkPosition: option.data, dropdownSelectedOptionKey: option.key, }); }; private _onShowMenuClicked = (): void => { this.setState({ isCoachmarkVisible: !this.state.isCoachmarkVisible, }); }; }