All files / components/Icon/ChevronThinIcon ChevronThinIcon.jsx

100% Statements 6/6
100% Branches 2/2
100% Functions 0/0
100% Lines 6/6
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              134x   134x             134x                         268x           14x   14x                                
import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { lucidClassNames } from '../../../util/style-helpers';
import { createClass, omitProps } from '../../../util/component-types';
import Icon from '../Icon';
 
const cx = lucidClassNames.bind('&-ChevronThinIcon');
 
const { oneOf } = PropTypes;
 
/**
 * {"categories": ["visual design", "icons"], "extend": "Icon", "madeFrom": ["Icon"]}
 *
 * A flat, thin chevron icon for directional navigation.
 */
const ChevronThinIcon = createClass({
	displayName: 'ChevronThinIcon',
	_isPrivate: true,
 
	propTypes: {
		...Icon.propTypes,
		/**
		 * direction variations of the icon
		 */
		direction: oneOf(['left', 'right']),
	},
 
	getDefaultProps() {
		return {
			direction: 'right',
		};
	},
 
	render() {
		const { className, direction, size, ...passThroughs } = this.props;
 
		return (
			<Icon
				{...omitProps(passThroughs, ChevronThinIcon, [], false)}
				{..._.pick(passThroughs, _.keys(Icon.propTypes))}
				className={cx('&', className)}
				size={size}
			>
				{direction === 'right'
					? <path d="M5 0l8 8-8 8-.75-.75L11.5 8 4.25.75z" />
					: <path d="M12 0L4 8l8 8 .75-.75L5.5 8 12.75.75z" />}
			</Icon>
		);
	},
});
 
export default ChevronThinIcon;