Skip to content

Commit 15019ae

Browse files
author
Simon Planinschek
authored
Merge pull request #7 from aboutbits/optional_title
Optional title
2 parents 1828826 + 8a8de76 commit 15019ae

1,802 files changed

Lines changed: 11828 additions & 6267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ const axios = require('axios')
66
const iconURL = 'https://fonts.google.com/metadata/icons'
77

88
function setup() {
9-
let typesFile = "import React from 'react'\n\n"
10-
typesFile +=
11-
'export interface IconProps extends React.SVGProps<SVGSVGElement> {\n'
12-
typesFile += '\ttitle?: string\n'
13-
typesFile += '}\n'
9+
const typesFile = `
10+
import React from 'react'
11+
export interface IconProps extends React.SVGProps<SVGSVGElement> {
12+
title?: string
13+
}
14+
`
1415

1516
// Create types file
1617
fs.writeFileSync(path.join(__dirname, 'src', 'types.ts'), typesFile)
@@ -41,13 +42,16 @@ function formatName(string) {
4142
* @returns {string} - Component
4243
*/
4344
function componentTemplate(name, svg) {
44-
let component = "import React from 'react'\n"
45-
component += "import { IconProps } from './types'\n\n"
46-
component += `const ${name}: React.FC<IconProps> = ({ title = '${name}', ...props }) => (`
47-
component += svg + ')\n\n'
48-
component += `export { ${name} as default }`
49-
50-
return component
45+
return `
46+
import React from 'react'
47+
import { IconProps } from './types'
48+
49+
const ${name}: React.FC<IconProps> = ({ ...props }) => (
50+
${svg}
51+
)
52+
53+
export { ${name} as default }
54+
`
5155
}
5256

5357
/**
@@ -86,7 +90,7 @@ async function getSVGFile(icon, version) {
8690
.replace(/enable-background/g, 'enableBackground')
8791
.replace(/clip-rule/g, 'clipRule')
8892
.replace(/fill-rule/g, 'fillRule')
89-
.replace('>', '><title>{title}</title>')
93+
.replace('>', '>{props.title && <title>{props.title}</title>}')
9094
}
9195

9296
/**

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@
4040
"devDependencies": {
4141
"@types/jest": "^26.0.14",
4242
"@types/react": "^16.9.50",
43-
"@typescript-eslint/parser": "^4.3.0",
4443
"@typescript-eslint/eslint-plugin": "^4.3.0",
45-
"react": "^16.13.1",
46-
"react-dom": "^16.13.1",
47-
"axios": "^0.20.0",
48-
"jest": "^26.4.2",
44+
"@typescript-eslint/parser": "^4.3.0",
45+
"axios": "^0.21.1",
4946
"eslint": "^7.10.0",
5047
"eslint-config-prettier": "^6.12.0",
5148
"eslint-plugin-import": "^2.22.1",
5249
"eslint-plugin-jest": "^24.0.2",
5350
"eslint-plugin-prettier": "^3.1.4",
51+
"jest": "^26.4.2",
5452
"prettier": "^2.1.2",
53+
"react": "^16.13.1",
54+
"react-dom": "^16.13.1",
5555
"ts-jest": "^26.4.1",
5656
"typescript": "^4.0.3"
5757
},

src/Icon10k.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon10k: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M10 10.5h1.5v3H10zM19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM7.5 15H6v-4.5H4.5V9h3v6zm5.5-1c0 .55-.45 1-1 1H9.5c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1H12c.55 0 1 .45 1 1v4zm6.5 1h-1.75L16 12.75V15h-1.5V9H16v2.25L17.75 9h1.75l-2.25 3 2.25 3z" />
9+
</svg>
10+
)
11+
12+
export { Icon10k as default }

src/Icon10mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon10mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M13.5 7H15v3h-1.5zM19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM10 5.5v6H8.5V7H7V5.5h3zm6.5 5c0 .55-.45 1-1 1H13c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h2.5c.55 0 1 .45 1 1v4zm-1 3.5H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon10mp as default }

src/Icon11mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon11mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM11 5.5v6H9.5V7H8V5.5h3zm5 0v6h-1.5V7H13V5.5h3zm-.5 8.5H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon11mp as default }

src/Icon12mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon12mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM10 5.5v6H8.5V7H7V5.5h3zM15.5 9h-2v1h3v1.5H12V9c0-.55.45-1 1-1h2V7h-3V5.5h3.5c.55 0 1 .45 1 1V8c0 .55-.45 1-1 1zm0 5H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon12mp as default }

src/Icon13mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon13mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM10 5.5v6H8.5V7H7V5.5h3zm6.5 5c0 .55-.45 1-1 1H12V10h3V9h-2V8h2V7h-3V5.5h3.5c.55 0 1 .45 1 1v4zm-1 3.5H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon13mp as default }

src/Icon14mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon14mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM10 5.5v6H8.5V7H7V5.5h3zm7.5 4.5h-1v1.5H15V10h-3V5.5h1.5v3H15v-3h1.5v3h1V10zm-2 4H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon14mp as default }

src/Icon15mp.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { IconProps } from './types'
3+
4+
const Icon15mp: React.FC<IconProps> = ({ ...props }) => (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
6+
{props.title && <title>{props.title}</title>}
7+
<path d="M0 0h24v24H0V0z" fill="none" />
8+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 15.5h-1.5V14h-1v3H8v-3H7v4.5H5.5v-5c0-.55.45-1 1-1H11c.55 0 1 .45 1 1v5zm3.5 0H14v-6h3.5c.55 0 1 .45 1 1V16c0 .55-.45 1-1 1h-2v1.5zM10 5.5v6H8.5V7H7V5.5h3zM16.5 7h-3v1h2c.55 0 1 .45 1 1v1.5c0 .55-.45 1-1 1H12V10h3V9h-3V5.5h4.5V7zm-1 7H17v1.5h-1.5z" />
9+
</svg>
10+
)
11+
12+
export { Icon15mp as default }

0 commit comments

Comments
 (0)