/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */ import * as React from 'react'; import Screener from 'screener-storybook/src/screener'; import { storiesOf } from '@storybook/react'; import { FabricDecoratorTallFixedWidth } from '../utilities'; import { ComboBox, SelectableOptionMenuItemType, ISelectableOption } from 'office-ui-fabric-react'; const testOptions = [ { key: 'Header', text: 'Theme Fonts', itemType: SelectableOptionMenuItemType.Header }, { key: 'A', text: 'Arial Black' }, { key: 'B', text: 'Times New Roman' }, { key: 'divider_2', text: '-', itemType: SelectableOptionMenuItemType.Divider }, { key: 'Header1', text: 'Other Options', itemType: SelectableOptionMenuItemType.Header }, { key: 'D', text: 'Option d' }, ]; const fontMapping: { [key: string]: string } = { 'Arial Black': '"Arial Black", "Arial Black_MSFontService", sans-serif', 'Time New Roman': '"Times New Roman", "Times New Roman_MSFontService", serif', }; const onRenderFontOption = (item: ISelectableOption) => { if ( item.itemType === SelectableOptionMenuItemType.Header || item.itemType === SelectableOptionMenuItemType.Divider ) { return {item.text}; } let fontFamily = fontMapping[item.text]; if (!fontFamily) { // This is a new user-entered font. Add a font family definition for it. const newFontName = item.text; fontFamily = fontMapping[newFontName] = `"${newFontName}","Segoe UI",Tahoma,Sans-Serif`; } return {item.text}; }; storiesOf('ComboBox', module) .addDecorator(FabricDecoratorTallFixedWidth) .addDecorator(story => ( {story()} )) .addStory( 'Root', () => ( ), { rtl: true, }, ) .addStory('Styled', () => ( )) .addStory('Disabled', () => // prettier-ignore , ) .addStory('Error', () => ( )) .addStory('Placeholder', () => // prettier-ignore , );