File size: 4,286 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import { PureComponent } from 'react';
import Sidebar from 'calypso/layout/sidebar';
import SidebarHeading from 'calypso/layout/sidebar/heading';
import SidebarItem from 'calypso/layout/sidebar/item';
import SidebarMenu from 'calypso/layout/sidebar/menu';
import SidebarSeparator from 'calypso/layout/sidebar/separator';

export default class DevdocsSidebar extends PureComponent {
	static displayName = 'DevdocsSidebar';

	isItemSelected( itemPath, isStrict = true ) {
		const { path } = this.props;

		if ( isStrict ) {
			return path === itemPath;
		}

		return path.indexOf( itemPath ) === 0;
	}

	render() {
		return (
			<Sidebar>
				<a href="/devdocs">
					<h1 className="devdocs__title">Calypso Docs</h1>
				</a>
				<SidebarMenu>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="search"
						label="Search"
						link="/devdocs"
						selected={ this.isItemSelected( '/devdocs' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="location"
						label="The Calypso Guide"
						link="/devdocs/docs/guide/index.md"
						selected={ this.isItemSelected( '/devdocs/docs/guide', false ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="pencil"
						label="Contributing"
						link="/devdocs/docs/CONTRIBUTING.md"
						selected={ this.isItemSelected( '/devdocs/docs/CONTRIBUTING.md' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="multiple-users"
						label="Accessibility"
						link="/devdocs/docs/accessibility.md"
						selected={ this.isItemSelected( '/devdocs/docs/accessibility.md' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="ink"
						label="Color"
						link="/devdocs/docs/color.md"
						selected={ this.isItemSelected( '/devdocs/docs/color.md' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="heading"
						label="Typography"
						link="/devdocs/typography"
						selected={ this.isItemSelected( '/devdocs/typography' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="types"
						label="Icons"
						link="/devdocs/docs/icons.md"
						selected={ this.isItemSelected( '/devdocs/docs/icons.md' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="image"
						label="Illustrations"
						link="/devdocs/illustrations"
						selected={ this.isItemSelected( '/devdocs/illustrations' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="globe"
						label="Internationalization"
						link="/devdocs/docs/i18n.md"
						selected={ this.isItemSelected( '/devdocs/docs/i18n.md' ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="bug"
						label="Testing"
						link="/devdocs/docs/testing/index.md"
						selected={ this.isItemSelected( '/devdocs/docs/testing', false ) }
					/>
					<SidebarSeparator />

					<SidebarHeading>Live Docs</SidebarHeading>

					<SidebarItem
						className="devdocs__navigation-item"
						icon="layout-blocks"
						label="UI Components"
						link="/devdocs/design"
						selected={ this.isItemSelected( '/devdocs/design', false ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="custom-post-type"
						label="Blocks"
						link="/devdocs/blocks"
						selected={ this.isItemSelected( '/devdocs/blocks', false ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="code"
						label="Playground"
						link="/devdocs/playground"
						selected={ this.isItemSelected( '/devdocs/playground', false ) }
					/>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="image-multiple"
						label="WordPress Components"
						link="/devdocs/wordpress-components-gallery"
						selected={ this.isItemSelected( '/devdocs/wordpress-components-gallery', false ) }
					/>
					<SidebarSeparator />

					<SidebarHeading>Developer Tools</SidebarHeading>
					<SidebarItem
						className="devdocs__navigation-item"
						icon="plugins"
						label="State Selectors"
						link="/devdocs/selectors"
						selected={ this.isItemSelected( '/devdocs/selectors', false ) }
					/>
				</SidebarMenu>
			</Sidebar>
		);
	}
}