import clsx from 'clsx';
import PropTypes from 'prop-types';

export default function JetpackIcons( props ) {
	const { className, icon, size = 28 } = props;

	const classes = clsx( 'sidebar__menu-icon', className );

	const iconAssets = {
		'activity-log':
			'M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z',
		backup:
			'M15.82 11.373l.013-1.277v-.03c0-1.48-1.352-2.9-3.3-2.9-1.627 0-2.87 1.015-3.205 2.208l-.32 1.143-1.186-.048a2.192 2.192 0 00-.089-.002c-1.19 0-2.233 1.008-2.233 2.35 0 1.34 1.04 2.348 2.23 2.35H16.8c.895 0 1.7-.762 1.7-1.8 0-.927-.649-1.643-1.423-1.777l-1.258-.217zM7.883 8.97l-.15-.003C5.67 8.967 4 10.69 4 12.817c0 2.126 1.671 3.85 3.733 3.85H16.8c1.767 0 3.2-1.478 3.2-3.3 0-1.635-1.154-2.993-2.667-3.255v-.045c0-2.43-2.149-4.4-4.8-4.4-2.237 0-4.118 1.403-4.65 3.303z',
		'credit-card':
			'M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z',
		help: 'M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z',
		licenses:
			'M9 13.5a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM9 16a4.002 4.002 0 003.8-2.75H15V16h2.5v-2.75H19v-2.5h-6.2A4.002 4.002 0 005 12a4 4 0 004 4z',
		licenses_line:
			'M9 15.5C10.933 15.5 12.5 13.933 12.5 12C12.5 10.067 10.933 8.5 9 8.5C7.067 8.5 5.5 10.067 5.5 12C5.5 13.933 7.067 15.5 9 15.5ZM13.9753 12.4998C13.9916 12.3354 14 12.1687 14 12C14 11.8363 13.9921 11.6744 13.9767 11.5146L18.4997 11.5146L18.4997 12.5848C17.9136 12.7913 17.4941 13.3506 17.4955 14.0072L17.4965 14.4958L16.5007 14.4974L16.4965 12.4998L13.9753 12.4998ZM13.5841 13.9998C12.8126 15.7658 11.0504 17 9 17C6.23858 17 4 14.7614 4 12C4 9.23858 6.23858 7 9 7C11.056 7 12.8221 8.24092 13.5903 10.0146H19.7996C19.9101 10.0146 19.9996 10.1042 19.9996 10.2146L19.9997 13.7997C19.9997 13.9102 19.9101 13.9998 19.7997 13.9998L18.9997 13.9998C18.9974 13.9998 18.9955 14.0016 18.9955 14.004L18.9993 15.7933C18.9995 15.9038 18.9101 15.9936 18.7996 15.9937L15.2038 15.9994C15.0934 15.9996 15.0037 15.9103 15.0035 15.7999L14.9997 13.9998L13.5841 13.9998ZM10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11C9.55228 11 10 11.4477 10 12Z',
		money:
			'M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z',
		page: 'M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z',
		scan: 'M12 3.176l6.75 3.068v4.574c0 3.9-2.504 7.59-6.035 8.755a2.283 2.283 0 01-1.43 0c-3.53-1.164-6.035-4.856-6.035-8.755V6.244L12 3.176zM6.75 7.21v3.608c0 3.313 2.145 6.388 5.005 7.33.159.053.331.053.49 0 2.86-.942 5.005-4.017 5.005-7.33V7.21L12 4.824 6.75 7.21z',
		search:
			'M17.5 11.5a4 4 0 11-8 0 4 4 0 018 0zm1.5 0a5.5 5.5 0 01-9.143 4.121l-3.363 2.943-.988-1.128 3.373-2.952a5.5 5.5 0 1110.12-2.984z',
		settings:
			'M10.29 4.836A1 1 0 0111.276 4h1.306a1 1 0 01.986.836l.245 1.466c.787.26 1.502.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.245 1.466a1 1 0 01-.986.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.993 5.993 0 012.108-1.218l.244-1.466zM14.93 12a3 3 0 11-6 0 3 3 0 016 0z',
		wordpress:
			'M21 12c0-4.959-4.041-9-9-9-4.968 0-9 4.041-9 9 0 4.968 4.032 9 9 9 4.959 0 9-4.032 9-9zm-10.998 4.833l-3.07-8.235c.496-.018 1.054-.072 1.054-.072.45-.054.396-1.017-.054-1 0 0-1.305.1-2.133.1-.162 0-.333 0-.522-.01A7.984 7.984 0 0112 4c2.097 0 4.005.783 5.445 2.106-.612-.1-1.485.35-1.485 1.422 0 .583.31 1.083.66 1.646l.15.244c.315.549.495 1.224.495 2.214 0 1.34-1.26 4.5-1.26 4.5l-2.727-7.533c.486-.018.738-.153.738-.153.45-.045.396-1.125-.054-1.098 0 0-1.296.108-2.142.108-.783 0-2.097-.108-2.097-.108-.45-.027-.504 1.08-.054 1.098l.828.072 1.134 3.069L10 16.833zm8.687-4.885l-.02.052c-.652 1.717-1.3 3.449-1.945 5.177l-.002.004-.002.005-.68 1.816C18.445 17.616 20 14.962 20 12c0-1.386-.314-2.664-.944-3.825.27 2.079-.145 3.183-.367 3.773zm-10.2 7.333C5.809 17.985 4 15.177 4 12c0-1.17.207-2.232.648-3.231l.809 2.216c1.008 2.765 2.018 5.533 3.034 8.296zm5.95.315l-2.323-6.282c-.428 1.262-.859 2.524-1.29 3.79-.296.864-.592 1.73-.888 2.6a7.09 7.09 0 002.061.297c.855 0 1.665-.144 2.44-.405z',
		dashboard:
			'M14 20H20V7.86207L12 4L4 7.86207V20H10H14ZM14 18.5H18.5V8.80358L12 5.66565L5.5 8.80358V18.5H10V13H14V18.5Z',
		social:
			'M15.5 3.97809V18.0219L7.5 15.5977V20H6V15.1431L3.27498 14.3173C2.22086 13.9979 1.5 13.0262 1.5 11.9248V10.0752C1.5 8.97375 2.22087 8.00207 3.27498 7.68264L15.5 3.97809ZM14 16L7.5 14.0303L7.5 7.96969L14 5.99999V16ZM6 8.42423L6 13.5757L3.70999 12.8818C3.28835 12.754 3 12.3654 3 11.9248V10.0752C3 9.63462 3.28835 9.24595 3.70999 9.11818L6 8.42423ZM17.5 11.75H21.5V10.25H17.5V11.75ZM21.5 16L17.5 15V13.5L21.5 14.5V16ZM17.5 8.5L21.5 7.5V6L17.5 7V8.5Z',
		prices:
			'M23.45 13.0667L15.6334 5.25C15.5167 5.13333 15.2834 5.01667 15.05 5.01667H5.83336C5.36669 4.9 4.90002 5.36667 4.90002 5.83333V14.9333C4.90002 15.1667 5.01669 15.4 5.13336 15.5167L12.95 23.3333C13.1834 23.5667 13.5334 23.8 13.7667 23.9167C14 24.0333 14.4667 24.15 14.8167 24.15C15.1667 24.15 15.5167 24.0333 15.8667 23.9167C16.2167 23.8 16.45 23.5667 16.8 23.3333L23.3334 16.8C23.8 16.3333 24.15 15.6333 24.15 14.9333C24.2667 14.2333 23.9167 13.5333 23.45 13.0667V13.0667ZM22.1667 15.6333L15.6334 22.1667C15.5167 22.2833 15.4 22.2833 15.2834 22.4C15.05 22.5167 14.8167 22.5167 14.5834 22.4C14.4667 22.4 14.35 22.2833 14.2334 22.1667L6.65002 14.5833V6.76667H14.5834L22.1667 14.35C22.4 14.5833 22.4 14.8167 22.4 15.05C22.4 15.1667 22.4 15.4 22.1667 15.6333ZM10.5 9.33333C9.80002 9.33333 9.33336 9.8 9.33336 10.5C9.33336 11.2 9.80002 11.6667 10.5 11.6667C11.2 11.6667 11.6667 11.2 11.6667 10.5C11.6667 9.8 11.2 9.33333 10.5 9.33333Z',
	};

	return (
		<svg
			className={ classes }
			viewBox="0 0 24 24"
			width={ size }
			height={ size }
			fill="none"
			xmlns="http://www.w3.org/2000/svg"
		>
			<path fillRule="evenodd" clipRule="evenodd" d={ iconAssets[ icon ] } />
		</svg>
	);
}

JetpackIcons.propTypes = {
	className: PropTypes.string,
	icon: PropTypes.string,
	size: PropTypes.number,
};
