import React from 'react'; import _ from 'lodash'; import styles from './iconPicker.less'; const requireContext = require.context('annotation/draw/svgs/', false, /^./.*.svg$/); export default class extends React.PureComponent { render() { return ( <ul className={styles.ul}> {_.reduce( requireContext.keys(), (pre, cur) => [ ...pre, <li id={cur} key={cur} className={styles.li}><embed type="image/svg+xml" width={18} height={18} src={requireContext(cur)} /></li>, ], [] )} </ul> ); } }
.ul { list-style-type: none; border: 1px solid #dedede; padding: 0px; margin: 4px 0px 4px 0px; position: relative; display: flow-root; .li { float: left; border: 1px solid #fff; line-height: 12px; vertical-align: middle; margin: 2px; padding: 2px; &:hover { border: 1px solid rgb(3, 189, 202); box-shadow:0 0 1px rgb(9, 180, 223); } } }