mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 00:26:51 +08:00
chore: reduce code by gndelia/codemod-replace-react-fc-typescript
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -14,7 +14,7 @@ interface SliderProps {
|
||||
onChange?: SliderUnstyledProps['onChange'];
|
||||
}
|
||||
|
||||
export const Slider: FC<SliderProps> = props => {
|
||||
export const Slider = (props: SliderProps) => {
|
||||
return <StyledSlider {...props} />;
|
||||
};
|
||||
|
||||
|
||||
@@ -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' : ''}`}
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user