import * as React from 'react'; import { Link, Stack, StackItem, MessageBar, MessageBarType, ChoiceGroup, IStackProps } from '@fluentui/react'; import { DefaultButton, MessageBarButton, PrimaryButton } from '@fluentui/react/lib/Button'; interface IExampleProps { resetChoice?: () => void; } const horizontalStackProps: IStackProps = { horizontal: true, tokens: { childrenGap: 16 }, }; const verticalStackProps: IStackProps = { styles: { root: { overflow: 'hidden', width: '100%', maxWidth: 600 } }, tokens: { childrenGap: 20 }, }; const choiceGroupStyles = { label: { maxWidth: 250, }, }; const DefaultExample = (p: IExampleProps) => ( Info/Default MessageBar. Visit our website. ); const ErrorExample = (p: IExampleProps) => ( Error MessageBar with single line, with dismiss button. Visit our website. ); const BlockedExample = (p: IExampleProps) => ( Blocked MessageBar - single line, with dismiss button and truncated text. Truncation is not available if you use action buttons or multiline and should be used sparingly. Lorem ipsum dolor sit amet, consectetur adipiscing condimentum mauris. ); const SevereExample = (p: IExampleProps) => ( Yes No } > SevereWarning MessageBar with action buttons which defaults to multiline. Visit our website. ); const SuccessExample = () => ( Yes No } messageBarType={MessageBarType.success} isMultiline={false} > Success MessageBar with single line and action buttons. Visit our website. ); const WarningExample = (p: IExampleProps) => ( Action Action } > Warning MessageBar content. Visit our website. ); const choiceOptions = [ { key: 'default', text: 'Default', }, { key: 'error', text: 'Error MessageBar', }, { key: 'blocked', text: 'Blocked MessageBar', }, { key: 'severe', text: 'SevereWarning MessageBar', }, { key: 'success', text: 'Success MessageBar', }, { key: 'warning', text: 'Warning MessageBar - single line', }, { key: 'all', text: 'Show All', }, ]; export const MessageBarBasicExample: React.FunctionComponent = () => { const [choice, setChoice] = React.useState(undefined); const showAll = choice === 'all'; const resetChoice = React.useCallback(() => setChoice(undefined), []); return ( setChoice(v!.key)} options={choiceOptions} /> {(choice === 'default' || showAll) && } {(choice === 'error' || showAll) && } {(choice === 'blocked' || showAll) && } {(choice === 'severe' || showAll) && } {(choice === 'success' || showAll) && } {(choice === 'warning' || showAll) && } ); };