-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate INTERNAL components for video effects (#5023)
- Loading branch information
1 parent
e0c5e32
commit 7fd3865
Showing
5 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/storybook8/stories/INTERNAL/VideoEffects/Docs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Canvas, Meta } from '@storybook/addon-docs'; | ||
import * as VideoEffectsStories from './index.stories'; | ||
import SelectableVideoEffectsExample from '!!raw-loader!./snippets/SelectableVideoEffects.snippet.tsx'; | ||
import VideoBackgroundEffectsPickerExample from '!!raw-loader!./snippets/VideoBackgroundEffectsPicker.snippet.tsx'; | ||
|
||
<Meta of={VideoEffectsStories} /> | ||
|
||
# Video Background Effects | ||
|
||
Components to allow a user to select video background effects. | ||
|
||
## Video Background Effects Item | ||
|
||
A selection of premade video effects items. | ||
|
||
<Canvas | ||
of={VideoEffectsStories.SelectableVideoEffectsExampleDocsOnly} | ||
source={{ code: SelectableVideoEffectsExample }} | ||
/> | ||
|
||
## Video Background Effects Picker | ||
|
||
The picker can be used as a choice group to allow users to select backgrounds. | ||
|
||
<Canvas | ||
of={VideoEffectsStories.VideoBackgroundEffectsPickerExampleDocsOnly} | ||
source={{ code: VideoBackgroundEffectsPickerExample }} | ||
/> |
22 changes: 22 additions & 0 deletions
22
packages/storybook8/stories/INTERNAL/VideoEffects/VideoEffects.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { registerIcons } from '@fluentui/react'; | ||
import { ImageAdd20Regular, VideoBackgroundEffect20Regular, VideoPerson20Filled } from '@fluentui/react-icons'; | ||
import { | ||
_VideoEffectsItemNoBackground, | ||
_VideoEffectsItemBlur, | ||
_VideoEffectsItemAddImage | ||
} from '@internal/react-components'; | ||
import React from 'react'; | ||
import { VideoBackgroundEffectsPicker } from './snippets/VideoBackgroundEffectsPicker.snippet'; | ||
|
||
registerIcons({ | ||
icons: { | ||
VideoEffectsNone: <VideoPerson20Filled />, | ||
VideoEffectsBlur: <VideoBackgroundEffect20Regular />, | ||
VideoEffectsAddImage: <ImageAdd20Regular /> | ||
} | ||
}); | ||
|
||
export const VideoEffects = VideoBackgroundEffectsPicker.bind({}); |
24 changes: 24 additions & 0 deletions
24
packages/storybook8/stories/INTERNAL/VideoEffects/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { Meta } from '@storybook/react'; | ||
import { SelectableVideoEffects } from './snippets/SelectableVideoEffects.snippet'; | ||
import { VideoBackgroundEffectsPicker } from './snippets/VideoBackgroundEffectsPicker.snippet'; | ||
|
||
export { VideoEffects } from './VideoEffects.story'; | ||
|
||
export const VideoBackgroundEffectsPickerExampleDocsOnly = { | ||
render: VideoBackgroundEffectsPicker | ||
}; | ||
|
||
export const SelectableVideoEffectsExampleDocsOnly = { | ||
render: SelectableVideoEffects | ||
}; | ||
|
||
const meta: Meta = { | ||
title: 'Components/Internal/Video Effects', | ||
component: VideoBackgroundEffectsPicker, | ||
argTypes: {} | ||
}; | ||
|
||
export default meta; |
63 changes: 63 additions & 0 deletions
63
...ages/storybook8/stories/INTERNAL/VideoEffects/snippets/SelectableVideoEffects.snippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { registerIcons, Stack } from '@fluentui/react'; | ||
import { ImageAdd20Regular, VideoBackgroundEffect20Regular, VideoPerson20Filled } from '@fluentui/react-icons'; | ||
import { | ||
_VideoEffectsItemNoBackground, | ||
_VideoEffectsItemBlur, | ||
_VideoEffectsItemAddImage, | ||
_VideoEffectsItem | ||
} from '@internal/react-components'; | ||
import React from 'react'; | ||
|
||
registerIcons({ | ||
icons: { | ||
VideoEffectsNone: <VideoPerson20Filled />, | ||
VideoEffectsBlur: <VideoBackgroundEffect20Regular />, | ||
VideoEffectsAddImage: <ImageAdd20Regular /> | ||
} | ||
}); | ||
|
||
const sampleBackgrounds = [ | ||
'images/video-background-effects/bg1.jpg', | ||
'images/video-background-effects/bg2.jpg', | ||
'images/video-background-effects/bg3.jpg' | ||
]; | ||
|
||
export const SelectableVideoEffects = (): JSX.Element => { | ||
const [selectedEffect, setSelectedEffect] = React.useState<string>('none'); | ||
return ( | ||
<Stack tokens={{ childrenGap: '1rem' }}> | ||
<Stack horizontal tokens={{ childrenGap: '1rem' }}> | ||
<_VideoEffectsItemNoBackground | ||
isSelected={selectedEffect === 'none'} | ||
onSelect={() => setSelectedEffect('none')} | ||
itemKey={'none'} | ||
/> | ||
<_VideoEffectsItemBlur | ||
isSelected={selectedEffect === 'blur'} | ||
onSelect={() => setSelectedEffect('blur')} | ||
itemKey={'blur'} | ||
/> | ||
<_VideoEffectsItemAddImage | ||
isSelected={selectedEffect === 'addImage'} | ||
onSelect={() => setSelectedEffect('addImage')} | ||
itemKey={'addImage'} | ||
disabled | ||
/> | ||
</Stack> | ||
<Stack horizontal tokens={{ childrenGap: '1rem' }}> | ||
{sampleBackgrounds.slice(0, 3).map((url, index) => ( | ||
<_VideoEffectsItem | ||
key={`customBackground${index}`} | ||
isSelected={selectedEffect === `bg${index}`} | ||
onSelect={() => setSelectedEffect(`bg${index}`)} | ||
itemKey={`customBackground${index}`} | ||
backgroundProps={{ url }} | ||
/> | ||
))} | ||
</Stack> | ||
</Stack> | ||
); | ||
}; |
112 changes: 112 additions & 0 deletions
112
...torybook8/stories/INTERNAL/VideoEffects/snippets/VideoBackgroundEffectsPicker.snippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { registerIcons } from '@fluentui/react'; | ||
import { ImageAdd20Regular, VideoBackgroundEffect20Regular, VideoPerson20Filled } from '@fluentui/react-icons'; | ||
import { _VideoBackgroundEffectsPicker, _VideoBackgroundEffectChoiceOption } from '@internal/react-components'; | ||
import React from 'react'; | ||
|
||
registerIcons({ | ||
icons: { | ||
VideoEffectsNone: <VideoPerson20Filled />, | ||
VideoEffectsBlur: <VideoBackgroundEffect20Regular />, | ||
VideoEffectsAddImage: <ImageAdd20Regular /> | ||
} | ||
}); | ||
|
||
export const VideoBackgroundEffectsPicker = (): JSX.Element => { | ||
return ( | ||
<_VideoBackgroundEffectsPicker | ||
options={selectableVideoEffects} | ||
label={'Background'} | ||
defaultSelectedEffectKey={'blur'} | ||
/> | ||
); | ||
}; | ||
|
||
const selectableVideoEffects: _VideoBackgroundEffectChoiceOption[] = [ | ||
{ | ||
itemKey: 'none', | ||
iconProps: { | ||
iconName: 'VideoEffectsNone' | ||
}, | ||
title: 'None', | ||
tooltipProps: { | ||
content: 'Remove Background' | ||
} | ||
}, | ||
{ | ||
itemKey: 'blur', | ||
iconProps: { | ||
iconName: 'VideoEffectsBlur' | ||
}, | ||
title: 'Blurred', | ||
tooltipProps: { | ||
content: 'Blur Background' | ||
} | ||
}, | ||
{ | ||
itemKey: 'addImage', | ||
iconProps: { | ||
iconName: 'VideoEffectsAddImage' | ||
}, | ||
title: 'Image', | ||
tooltipProps: { | ||
content: 'Upload Background Image' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground1', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg1.jpg' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 1' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground2', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg2.jpg' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 2' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground3', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg3.jpg' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 3' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground4', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg4.png' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 4' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground5', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg5.png' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 5' | ||
} | ||
}, | ||
{ | ||
itemKey: 'customBackground6', | ||
backgroundProps: { | ||
url: 'images/video-background-effects/bg6.png' | ||
}, | ||
tooltipProps: { | ||
content: 'Custom Background 6' | ||
} | ||
} | ||
]; |