All files / components/Icon/ArrowIcon ArrowIcon.tsx

0% Statements 0/15
0% Branches 0/1
0% Functions 0/1
0% Lines 0/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                                                                                                                               
import _ from 'lodash';
import React from 'react';
import PropTypes from 'react-peek/prop-types';
import Icon, { IIconProps, propTypes as iconPropTypes } from '../Icon';
import { lucidClassNames } from '../../../util/style-helpers';
import { omitProps } from '../../../util/component-types';
 
const cx = lucidClassNames.bind('&-ArrowIcon');
 
const { oneOf } = PropTypes;
 
interface IArrowIconProps extends IIconProps {
	direction?: 'up' | 'down' | 'left' | 'right';
}
 
export const ArrowIcon = ({
	className,
	direction = 'left',
	...passThroughs
}: IArrowIconProps) => {
	return (
		<Icon
			{...omitProps(
				passThroughs,
				undefined,
				_.keys(ArrowIcon.propTypes),
				false
			)}
			{..._.pick(passThroughs, _.keys(iconPropTypes))}
			className={cx(
				'&',
				{
					'&-is-down': direction === 'down',
					'&-is-up': direction === 'up',
					'&-is-left': direction === 'left',
					'&-is-right': direction === 'right',
				},
				className
			)}
		>
			<path d='M0 8h15.5m-6-6l6 6-6 6' />
		</Icon>
	);
};
 
ArrowIcon.displayName = 'ArrowIcon';
ArrowIcon.peek = {
	description: `
		An arrow icon.
	`,
	categories: ['visual design', 'icons'],
	extend: 'Icon',
	madeFrom: ['Icon'],
};
ArrowIcon.propTypes = {
	...iconPropTypes,
	direction: oneOf(['up', 'down', 'left', 'right'])`
		direction variations of the icon
	`,
};
ArrowIcon.defaultProps = Icon.defaultProps;
 
export default ArrowIcon;