File size: 1,087 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Card } from '@automattic/components';
import { Icon, starEmpty as iconStar, category as iconCategory } from '@wordpress/icons';
import { FunctionComponent } from 'react';
import { CategoryPillNavigation } from 'calypso/components/category-pill-navigation';

const categories = Array.from( { length: 15 }, ( _, i ) => ( {
	id: `category-${ i }`,
	label: `Category ${ i }`,
	link: '#',
} ) );

const CategoryPillNavigationExample: FunctionComponent = () => {
	return (
		<div>
			<Card>
				<CategoryPillNavigation selectedCategoryId="category-2" categories={ categories } />
			</Card>

			<Card>
				<CategoryPillNavigation
					selectedCategoryId="category-2"
					buttons={ [
						{
							id: 'discover',
							icon: <Icon icon={ iconStar } size={ 30 } />,
							label: 'Discover',
							link: '/',
						},
						{
							id: 'all',
							icon: <Icon icon={ iconCategory } size={ 26 } />,
							label: 'All categories',
							link: '/',
						},
					] }
					categories={ categories }
				/>
			</Card>
		</div>
	);
};

export default CategoryPillNavigationExample;