-
Notifications
You must be signed in to change notification settings - Fork 2
/
Carouseltest.tsx
75 lines (69 loc) · 2.93 KB
/
Carouseltest.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
72
73
74
75
import * as React from 'react';
import styles from './Carouseltest.module.scss';
import { ICarouseltestProps } from './ICarouseltestProps';
import { escape } from '@microsoft/sp-lodash-subset';
import { ICarouseltestState } from './ICarouseltestState';
import { Carousel, Image, Provider, teamsTheme } from '@fluentui/react-northstar';
export default class Carouseltest extends React.Component<ICarouseltestProps, ICarouseltestState> {
constructor(props: ICarouseltestProps, state: ICarouseltestState) {
super(props);
}
public render(): React.ReactElement<ICarouseltestProps> {
const imageAltTags = {
ade: 'Portrait of Ade',
elliot: 'Portrait of Elliot',
molly: 'Portrait of Molly',
nan: 'Portrait of Nan',
};
const carouselItems = [
{
key: 'ade',
id: 'ade',
content: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/large/ade.jpg" fluid alt={'Portrait of Ade'} />,
thumbnail: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/small/ade.jpg" fluid alt={imageAltTags.ade} />,
'aria-label': imageAltTags.ade
},
{
key: 'elliot',
id: 'elliot',
content: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/large/elliot.jpg" fluid alt={imageAltTags.elliot} />,
thumbnail: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/small/elliot.jpg" fluid alt={imageAltTags.elliot} />,
'aria-label': imageAltTags.elliot,
},
{
key: 'molly',
id: 'molly',
content: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/large/molly.png" fluid alt={imageAltTags.molly} />,
thumbnail: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/small/molly.png" fluid alt={imageAltTags.molly} />,
'aria-label': imageAltTags.molly,
},
{
key: 'nan',
id: 'nan',
content: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/large/nan.jpg" fluid alt={imageAltTags.nan} />,
thumbnail: <Image src="https://fluentsite.z22.web.core.windows.net/public/images/avatar/small/nan.jpg" fluid alt={imageAltTags.nan} />,
'aria-label': imageAltTags.nan,
}
];
return (
<Provider theme={teamsTheme}>
<Carousel
ariaRoleDescription="carousel"
ariaLabel="Portrait collection"
thumbnails
navigation={{
'aria-label': 'people portraits',
items: carouselItems.map((item, index) => ({
key: index,
'aria-controls': item.id,
'aria-label': item['aria-label'],
content: item.thumbnail,
})),
}}
items={carouselItems}
getItemPositionText={(index: number, size: number) => `${index + 1} of ${size}`}
/>
</Provider>
);
}
}