import { useStringKnob, useBooleanKnob } from '@fluentui/docs-components'; import { AvatarProps, AlertProps, BoxProps, CardProps, DialogProps, DividerProps, EmbedProps, ImageProps, VideoProps, Avatar as _Avatar, CardBody as _CardBody, CardHeader as _CardHeader, Flex as _Flex, Text as _Text, DatepickerProps, InputProps, } from '@fluentui/react-northstar'; import * as _ from 'lodash'; import * as faker from 'faker'; import * as React from 'react'; import { KnobComponentGenerators } from '../../types'; import { number } from '../ComponentPlayground/typeGenerators'; export const Avatar: KnobComponentGenerators = { name: ({ propName }) => ({ hook: useStringKnob, name: propName, initialValue: _.capitalize(`${faker.name.firstName()} ${faker.name.lastName()}`), }), }; export const Box: KnobComponentGenerators = { // TODO: fix support for boxes children: () => null, }; export const Input: KnobComponentGenerators = { children: () => null, }; export const Datepicker: KnobComponentGenerators = { calendar: () => null, }; export const Card: KnobComponentGenerators = { children: () => { const name = `${faker.name.firstName()} ${faker.name.lastName()}`; const jobTitle = faker.name.jobTitle(); const content = faker.lorem.paragraph(); return { name: null, hook: () => [ [ <_CardHeader key="header"> <_Flex gap="gap.small"> <_Avatar image="public/images/avatar/small/matt.jpg" label={jobTitle} name={name} status="unknown" /> <_Flex column> <_Text content={name} weight="bold" /> <_Text content={jobTitle} size="small" /> , <_CardBody key="body">{content}, ], ], }; }, // disable horizontal as it requires different layout horizontal: () => null, }; export const Dialog: KnobComponentGenerators = { footer: () => null, }; export const Divider: KnobComponentGenerators = { // Workaround for `Divider` component that supports size in different way size: number, }; export const Embed: KnobComponentGenerators = { placeholder: ({ componentInfo, propName }) => ({ hook: useStringKnob, name: propName, initialValue: 'https://raw.githubusercontent.com/bower-media-samples/big-buck-bunny-480p-5s/master/poster.jpg', }), // Hack until `size` prop will not supported variables: () => ({ hook: () => [{ width: '480px' }], name: 'variables', }), }; export const Image: KnobComponentGenerators = { src: ({ propName }) => ({ hook: useStringKnob, name: propName, initialValue: faker.image.avatar(), }), }; export const Alert: KnobComponentGenerators = { visible: ({ propName }) => ({ hook: useBooleanKnob, name: propName, initialValue: true, }), }; export const Video: KnobComponentGenerators = { poster: ({ componentInfo, propName }) => ({ hook: useStringKnob, name: propName, initialValue: 'public/images/tears-of-steel.jpg', }), src: ({ propName }) => ({ hook: useStringKnob, name: propName, initialValue: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4', }), // Hack until `size` prop will not supported variables: () => ({ hook: () => [{ height: '300px', width: '720px' }], name: 'variables', }), };