Files
react/components/tree/tree-folder-icon.tsx
unix 4e7b4cc57d refactor: export all hooks functions directly from main module
refactor: rename the modules to make sure tree-shaking works
2020-05-16 23:04:57 +08:00

44 lines
1.2 KiB
TypeScript

import React from 'react'
import useTheme from '../styles/use-theme'
import withDefaults from '../utils/with-defaults'
interface Props {
color?: string
width?: number
height?: number
}
const defaultProps = {
width: 22,
height: 22,
}
export type TreeFolderIconProps = Props & typeof defaultProps
const TreeFolderIcon: React.FC<TreeFolderIconProps> = ({ color, width, height }) => {
const theme = useTheme()
return (
<svg
viewBox="0 0 24 24"
width={width}
height={height}
stroke="currentColor"
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
shapeRendering="geometricPrecision">
<path d="M2.707 7.454V5.62C2.707 4.725 3.469 4 4.409 4h4.843c.451 0 .884.17 1.204.474l.49.467c.126.12.296.186.473.186h8.399c.94 0 1.55.695 1.55 1.59v.737m-18.661 0h-.354a.344.344 0 00-.353.35l.508 11.587c.015.34.31.609.668.609h17.283c.358 0 .652-.269.667-.61L22 7.805a.344.344 0 00-.353-.35h-.278m-18.662 0h18.662" />
<style jsx>{`
svg {
color: ${color || theme.palette.accents_8};
}
`}</style>
</svg>
)
}
const MemoTreeFolderIcon = React.memo(TreeFolderIcon)
export default withDefaults(MemoTreeFolderIcon, defaultProps)