chore: reduce code by gndelia/codemod-replace-react-fc-typescript

This commit is contained in:
DarkSky
2022-08-12 01:26:27 +08:00
parent b4f56cda59
commit 40b617c429
73 changed files with 108 additions and 115 deletions
+2 -2
View File
@@ -39,13 +39,13 @@ interface IconButtonProps {
hoverColor?: string;
}
export const IconButton: FC<PropsWithChildren<IconButtonProps>> = ({
export const IconButton = ({
children,
disabled,
onClick,
className,
...props
}) => {
}: PropsWithChildren<IconButtonProps>) => {
return (
<Container
{...props}
+2 -2
View File
@@ -20,11 +20,11 @@ const _textAlignMap: Record<
end: 'right',
};
export const Divider: FC<DividerProps> = ({
export const Divider = ({
orientation = 'horizontal',
textAlign = 'center',
children,
}) => {
}: DividerProps) => {
return (
<StyledMuiDivider
orientation={orientation}
+2 -2
View File
@@ -9,13 +9,13 @@ interface ListItemProps {
style?: CSSProperties;
}
export const ListItem: FC<PropsWithChildren<ListItemProps>> = ({
export const ListItem = ({
active,
children,
onClick,
className,
style,
}) => {
}: PropsWithChildren<ListItemProps>) => {
return (
<Container
active={active}
+1 -6
View File
@@ -17,12 +17,7 @@ interface Props {
extraStyle?: CSSProperties;
}
export const OldSelect: FC<Props> = ({
value,
options,
onChange,
extraStyle,
}: Props) => {
export const OldSelect = ({ value, options, onChange, extraStyle }: Props) => {
const onSelectChange = useCallback(
(e: ChangeEvent<HTMLSelectElement>) => {
onChange(e.target.value);
+1 -1
View File
@@ -14,7 +14,7 @@ interface SliderProps {
onChange?: SliderUnstyledProps['onChange'];
}
export const Slider: FC<SliderProps> = props => {
export const Slider = (props: SliderProps) => {
return <StyledSlider {...props} />;
};
+2 -2
View File
@@ -19,7 +19,7 @@ export interface TagProps {
endElement?: ReactNode;
}
export const Tag: FC<PropsWithChildren<TagProps>> = ({
export const Tag = ({
onClick,
style,
children,
@@ -27,7 +27,7 @@ export const Tag: FC<PropsWithChildren<TagProps>> = ({
onClose,
startElement,
endElement,
}) => {
}: PropsWithChildren<TagProps>) => {
return (
<StyledTag
className={`affine-tag ${closeable ? 'affine-tag--closeable' : ''}`}
+1 -1
View File
@@ -23,7 +23,7 @@ const theme = createTheme({
affine: Theme,
});
export const ThemeProvider: FC<{ children?: ReactNode }> = ({ children }) => {
export const ThemeProvider = ({ children }: { children?: ReactNode }) => {
return <MuiThemeProvider theme={theme}>{children}</MuiThemeProvider>;
};