Skip to content

Commit 66520ea

Browse files
committed
chore(scripts): 更新new-component
1 parent 29fca3e commit 66520ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/new-component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,21 @@ function initComponent(): InitRes {
6565
import React from 'react';
6666
import type { ${props} } from './${getFilename('types').replace(/\.ts$/, '')}';
6767
import { getComponentClass } from '@pkg/shared';
68+
import type { RequiredPart } from '@tool-pack/types';
69+
import { getClassNames } from '@tool-pack/basic';
6870
6971
const rootName = getComponentClass('${config.name}');
7072
7173
export const ${componentName}: React.FC<${props}> = (props) => {
72-
return <div {...props} className={rootName}></div>;
74+
const { children, className, ...rest } = props as RequiredPart<
75+
TooltipProps,
76+
keyof typeof defaultProps
77+
>;
78+
return (
79+
<div {...rest} className={getClassNames(rootName, className)}>
80+
{children}
81+
</div>
82+
);
7383
};
7484
7585
const defaultProps = {} satisfies Partial<${props}>;

0 commit comments

Comments
 (0)