File size: 1,583 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
import { MaterialIcon } from '@automattic/components';
import PropTypes from 'prop-types';
import { Component, Fragment } from 'react';
import VerticalNavItem from 'calypso/components/vertical-nav/item';

const SecurityCheckupNavigationItemContents = function ( props ) {
	const { materialIcon, materialIconStyle, text, description } = props;
	return (
		<Fragment>
			<MaterialIcon
				icon={ materialIcon }
				style={ materialIconStyle }
				className="security-checkup__nav-item-icon"
			/>
			<div>
				<div>{ text }</div>
				<small>{ description }</small>
			</div>
		</Fragment>
	);
};

class SecurityCheckupNavigationItem extends Component {
	static propTypes = {
		description: PropTypes.node,
		external: PropTypes.bool,
		isPlaceholder: PropTypes.bool,
		materialIcon: PropTypes.string,
		materialIconStyle: PropTypes.string,
		onClick: PropTypes.func,
		path: PropTypes.string,
		text: PropTypes.string,
		disabled: PropTypes.bool,
	};

	render() {
		if ( this.props.isPlaceholder ) {
			return <VerticalNavItem isPlaceholder />;
		}

		return (
			<VerticalNavItem
				path={ this.props.path }
				onClick={ this.props.onClick }
				external={ this.props.external }
				className="security-checkup__nav-item"
				disabled={ this.props.disabled }
			>
				<SecurityCheckupNavigationItemContents
					materialIcon={ this.props.materialIcon }
					materialIconStyle={ this.props.materialIconStyle ?? 'outline' }
					text={ this.props.text }
					description={ this.props.description }
				/>
			</VerticalNavItem>
		);
	}
}

export default SecurityCheckupNavigationItem;