-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f8041
commit 79a83d5
Showing
7 changed files
with
89 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
const componentize = ({ | ||
componentName = 'ComponentName', | ||
node = '<svg />', | ||
}) => `export const ${componentName} = () => ( | ||
${node} | ||
import { parseSync, stringify } from 'svgson' | ||
|
||
const componentize = ({ componentName = 'ComponentName', node = '<svg />', title }) => { | ||
const { | ||
children, | ||
attributes: { fill, stroke, 'data-title': dataTitle, ...otherAttributes } = { | ||
fill: 'currentColor', | ||
stroke: 'currentColor', | ||
}, | ||
...others | ||
} = parseSync(node) | ||
|
||
return `import { IconProps } from '../Types' | ||
export const ${componentName} = ({title, fill = '${fill}', stroke = '${stroke}', ...props}: IconProps) => ( | ||
<svg ${Object.entries(otherAttributes) | ||
.map(([key, value]) => `${key}="${value}"`) | ||
.join(' ')} | ||
{...{ ...(title && {'data-title': title}), fill, stroke, ...props}} | ||
> | ||
\${title === undefined ? undefined : <title>{title}</title>} | ||
${stringify(children)} | ||
</svg> | ||
) | ||
` | ||
} | ||
|
||
export default componentize |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface IconProps { | ||
title?: string | ||
fill?: string | ||
stroke?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
export const Check = () => ( | ||
import { IconProps } from '../Types' | ||
|
||
export const Check = ({ | ||
title, | ||
fill = 'currentColor', | ||
stroke = 'currentColor', | ||
...props | ||
}: IconProps) => ( | ||
<svg | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
data-title="check" | ||
fill="currentColor" | ||
stroke="currentColor" | ||
{...{ ...(title && { 'data-title': title }), fill, stroke, ...props }} | ||
> | ||
<title>check</title> | ||
${title === undefined ? undefined : <title>{title}</title>} | ||
<path d="M8.91958 20.1667C8.73748 20.1667 8.56045 20.1323 8.38847 20.0635C8.21649 19.9947 8.05969 19.8915 7.91806 19.7539L2.42489 14.4176C2.14163 14.1425 2 13.8083 2 13.4152C2 13.0222 2.14163 12.688 2.42489 12.4129C2.70814 12.1377 3.04704 12.0001 3.44158 12.0001C3.83612 12.0001 4.18513 12.1377 4.48862 12.4129L8.91958 16.7173L19.5417 6.42797C19.825 6.1528 20.1639 6.0103 20.5584 6.00048C20.953 5.99065 21.2919 6.13315 21.5751 6.42797C21.8584 6.70313 22 7.03727 22 7.43036C22 7.82346 21.8584 8.15759 21.5751 8.43276L9.92109 19.7539C9.77946 19.8915 9.62266 19.9947 9.45068 20.0635C9.27871 20.1323 9.10167 20.1667 8.91958 20.1667Z" /> | ||
</svg> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters