Skip to content

Commit

Permalink
Use ES6 default properties instead of deprecated defaultProps property
Browse files Browse the repository at this point in the history
Fixes Iconscout#86 and Iconscout#64

The work on this PR was sponsored by [SUSI&James GmbH](https://susiandjames.com/)
  • Loading branch information
fnogatz committed Jul 10, 2024
1 parent bb3cbbc commit 5d932fe
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions build/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ uniconsConfig.forEach(icon => {
const template = `import React from 'react';
import PropTypes from 'prop-types';
const ${name} = (props) => {
const { color, size, ...otherProps } = props
const ${name} = ({ color = 'currentColor', size = '24', ...otherProps }) => {
return React.createElement('svg', {
xmlns: 'http://www.w3.org/2000/svg',
width: size,
Expand All @@ -48,11 +47,6 @@ ${name}.propTypes = {
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
${name}.defaultProps = {
color: 'currentColor',
size: '24',
};
export default ${name};`

fs.writeFileSync(location, template, 'utf-8')
Expand Down

0 comments on commit 5d932fe

Please sign in to comment.