/*! 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 { FabricDecoratorFullWidth } from '../utilities';
import { Fabric, mergeStyleSets, DefaultPalette, IStyle, Stack } from 'office-ui-fabric-react';
const rootStyles = {
background: DefaultPalette.themeTertiary,
};
const itemStyles = {
background: DefaultPalette.themePrimary,
color: DefaultPalette.white,
padding: 5,
};
const boxStyles: IStyle = {
...itemStyles,
display: 'flex',
justifyContent: 'center' as 'center',
alignItems: 'center' as 'center',
width: '50px',
height: '50px',
padding: 0,
};
const styles = mergeStyleSets({
root: rootStyles,
fixedHeight: {
...rootStyles,
height: '300px',
},
item: itemStyles,
boxItem: boxStyles,
verticalShrinkItem: {
...itemStyles,
height: '100px',
},
horizontalShrinkItem: {
...itemStyles,
width: '400px',
},
shadowItem: {
...boxStyles,
boxShadow: `0px 0px 5px 5px ${DefaultPalette.themeDarker}`,
},
});
const defaultProps = {
className: styles.root,
children: [
1
,
2
,
3
,
],
};
storiesOf('Stack', module)
.addDecorator(FabricDecoratorFullWidth)
.addDecorator(story =>
// prettier-ignore
{story()}
,
)
.addStory(
'Vertical Stack - Default',
() => (
),
{ rtl: true },
)
.addStory(
'Vertical Stack - Reversed',
() => (
),
{ rtl: true },
)
.addStory('Vertical Stack - Padding', () => (
))
.addStory('Vertical Stack - Gap', () => (
))
.addStory('Vertical Stack - Vertically centered', () => (
))
.addStory('Vertical Stack - Bottom-aligned', () => (
))
.addStory('Vertical Stack - Space around', () => (
))
.addStory('Vertical Stack - Space between', () => (
))
.addStory('Vertical Stack - Space evenly', () => (
))
.addStory('Vertical Stack - Horizontally centered', () => (
))
.addStory(
'Vertical Stack - Right-aligned',
() => (
),
{ rtl: true },
)
.addStory(
'Vertical Stack - Item alignments',
() => (
Auto-aligned item
Stretch-aligned item
Baseline-aligned item
Start-aligned item
Center-aligned item
End-aligned item
),
{ rtl: true },
)
.addStory('Vertical Stack - Growing items', () => (
Grow is 3
Grow is 2
Grow is 1
))
.addStory('Vertical Stack - Shrinking items', () => (
1
2 (does not shrink)
3
4
5
))
.addStory(
'Vertical Stack - Wrap',
() => (
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
),
{ rtl: true },
)
.addStory('Vertical Stack - Box shadow around items', () => (
1
2
3
4
5
))
.addStory(
'Horizontal Stack - Default',
() => (
),
{ rtl: true },
)
.addStory(
'Horizontal Stack - Reversed',
() => (
),
{ rtl: true },
)
.addStory('Horizontal Stack - Padding', () => (
))
.addStory(
'Horizontal Stack - Gap',
() => (
),
{ rtl: true },
)
.addStory('Horizontal Stack - Horizontally centered', () => (
))
.addStory(
'Horizontal Stack - Right-aligned',
() => (
),
{ rtl: true },
)
.addStory('Horizontal Stack - Space around', () => (
))
.addStory('Horizontal Stack - Space between', () => (
))
.addStory('Horizontal Stack - Space evenly', () => (
))
.addStory('Horizontal Stack - Vertically centered', () => (
))
.addStory('Horizontal Stack - Bottom-aligned', () => (
))
.addStory(
'Horizontal Stack - Item alignments',
() => (
Auto-aligned item
Stretch-aligned item
Baseline-aligned item
Start-aligned item
Center-aligned item
End-aligned item
),
{ rtl: true },
)
.addStory('Horizontal Stack - Growing items', () => (
Grow is 3
Grow is 2
Grow is 1
))
.addStory('Horizontal Stack - Shrinking items', () => (
1
2 (does not shrink)
3
4
5
6
7
))
.addStory(
'Horizontal Stack - Wrap',
() => (
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
22
23
24
25
26
27
28
29
30
),
{ rtl: true },
)
.addStory('Horizontal Stack - Wrap with specified vertical gap', () => (
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
22
23
24
25
26
27
28
29
30
))
.addStory('Horizontal Stack - Box shadow around items', () => (
1
2
3
4
5
));