All files / components/Icon/ChevronIcon ChevronIcon.jsx

100% Statements 6/6
100% Branches 0/0
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 55 56 57 58 59 60 61 62 63 64 65 66 67            120x       120x               120x                               120x                     66x   66x                                      
import _ from 'lodash';
import React from 'react';
import { lucidClassNames } from '../../../util/style-helpers';
import { createClass, omitProps } from '../../../util/component-types';
import Icon from '../Icon';
 
const cx = lucidClassNames.bind('&-ChevronIcon');
 
const {
	oneOf,
} = React.PropTypes;
 
/**
 *
 * {"categories": ["visual design", "icons"], "extend": "Icon", "madeFrom": ["Icon"]}
 *
 * A chevron icon.
 */
const ChevronIcon = createClass({
	displayName: 'ChevronIcon',
	propTypes: {
		...Icon.propTypes,
		/**
		 * direction variations of the icon
		 */
		direction: oneOf([
			'up',
			'down',
			'left',
			'right',
		]),
	},
 
	getDefaultProps() {
		return {
			direction: 'down',
		};
	},
 
	render() {
		const {
			className,
			direction,
			size,
			...passThroughs,
		} = this.props;
 
		return (
			<Icon
				{...omitProps(passThroughs, ChevronIcon)}
				{..._.pick(passThroughs, _.keys(Icon.propTypes))}
				className={cx('&', {
					'&-is-down': direction === 'down',
					'&-is-up': direction === 'up',
					'&-is-left': direction === 'left',
					'&-is-right': direction === 'right',
				}, className)}
				size={size}
			>
				<path d='M12.293,5.293 L13.707,6.707 L8.707,11.707 C8.317,12.098 7.683,12.098 7.293,11.707 L2.293,6.707 L3.707,5.293 L8,9.586 L12.293,5.293 z' />
			</Icon>
		);
	},
});
 
export default ChevronIcon;