/
Shimmer.Basic.Example.tsx
71 lines (67 loc) · 2.96 KB
/
Shimmer.Basic.Example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import * as React from 'react';
import {
Shimmer,
ShimmerElementType as ElemType,
ShimmerElementVerticalAlign as ElemVerticalAlign
} from '@uifabric/experiments/lib/Shimmer';
import './Shimmer.Example.scss';
export class ShimmerBasicExample extends React.Component<{}, {}> {
constructor(props: {}) {
super(props);
}
public render(): JSX.Element {
return (
<div className="shimmerBasicExample-container">
Basic Shimmer with no elements provided. It defaults to a line of 16px height.
<Shimmer />
<Shimmer widthInPercentage={75} />
<Shimmer widthInPercentage={50} />
Basic Shimmer with elements provided.
<Shimmer shimmerElements={[{ type: ElemType.circle }, { type: ElemType.gap, widthInPercentage: 2 }, { type: ElemType.line }]} />
<Shimmer
shimmerElements={[
{ type: ElemType.circle, height: 24 },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, height: 16, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 5 },
{ type: ElemType.line, height: 16, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 10 },
{ type: ElemType.line, height: 16, widthInPercentage: 15 },
{ type: ElemType.gap, widthInPercentage: 10 },
{ type: ElemType.line, height: 16 }
]}
/>
<Shimmer
widthInPercentage={70}
shimmerElements={[
{ type: ElemType.circle, height: 24 },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, height: 16, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 5 },
{ type: ElemType.line, height: 16, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 10 },
{ type: ElemType.line, height: 16, widthInPercentage: 15 },
{ type: ElemType.gap, widthInPercentage: 10 },
{ type: ElemType.line, height: 16 }
]}
/>
Variations of vertical alignment for Circles and Lines.
<Shimmer
shimmerElements={[
{ type: ElemType.circle },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.circle, height: 15, verticalAlign: ElemVerticalAlign.top },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, verticalAlign: ElemVerticalAlign.bottom, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, height: 5, verticalAlign: ElemVerticalAlign.top, widthInPercentage: 20 },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, height: 16, widthInPercentage: 15 },
{ type: ElemType.gap, widthInPercentage: 2 },
{ type: ElemType.line, height: 10, verticalAlign: ElemVerticalAlign.bottom }
]}
/>
</div>
);
}
}