mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: reduce code for icons
This commit is contained in:
@@ -100,19 +100,16 @@ module.exports = async function generateReactIcon(name, svgCode, customStyles) {
|
||||
const colors = getColors(colorIdx);
|
||||
|
||||
return `
|
||||
import { FC } from 'react';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { SvgIcon } from '@mui/material';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import type { SvgIconProps } from '@mui/material';
|
||||
import { SvgIcon, SvgIconProps } from '@mui/material';
|
||||
|
||||
export interface ${name}IconProps extends Omit<SvgIconProps, 'color'> {
|
||||
${getColorsInterfaceProps(colors)}
|
||||
}
|
||||
|
||||
export const ${name}Icon: FC<${name}IconProps> = ({ ${getRestColors(
|
||||
export const ${name}Icon = ({ ${getRestColors(
|
||||
colors
|
||||
)}, style, ...props}) => {
|
||||
)}, style, ...props}: ${name}IconProps) => {
|
||||
const propsStyles = ${getPropNameToColorValue(colors)};
|
||||
const customStyles = ${JSON.stringify(customStyles || {})};
|
||||
const styles = {...propsStyles, ...customStyles, ...style}
|
||||
|
||||
Reference in New Issue
Block a user