Kanishka Chowdhury 16d490fbe3
chore(FE): reduce main.js chunk size (#3486)
* refactor(FE/routes): lazy load DashboardWidget route

* refactor(FE/Styled): update antd import

* chore(FE): remove majority of import * and import only necessary items

* fix(FE): fix missing papa parse import

* fix(FE): fix missing papa parse import

---------

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
2023-09-06 19:00:00 +05:30

86 lines
1.9 KiB
TypeScript

import {
Button,
ButtonProps,
Col,
ColProps,
Divider,
DividerProps,
Row,
RowProps,
Space,
SpaceProps,
TabsProps,
Typography,
} from 'antd';
import { TextProps } from 'antd/lib/typography/Text';
import { TitleProps } from 'antd/lib/typography/Title';
import { HTMLAttributes } from 'react';
import styled, { FlattenSimpleInterpolation } from 'styled-components';
import { IStyledClass } from './types';
const styledClass = (props: IStyledClass): FlattenSimpleInterpolation | null =>
props.styledclass || null;
type TStyledCol = ColProps & IStyledClass;
const StyledCol = styled(Col)<TStyledCol>`
${styledClass}
`;
type TStyledRow = RowProps & IStyledClass;
const StyledRow = styled(Row)<TStyledRow>`
${styledClass}
`;
type TStyledDivider = DividerProps & IStyledClass;
const StyledDivider = styled(Divider)<TStyledDivider>`
${styledClass}
`;
type TStyledSpace = SpaceProps & IStyledClass;
const StyledSpace = styled(Space)<TStyledSpace>`
${styledClass}
`;
type TStyledTabs = TabsProps & IStyledClass;
const StyledTabs = styled(Divider)<TStyledTabs>`
${styledClass}
`;
type TStyledButton = ButtonProps & IStyledClass;
const StyledButton = styled(Button)<TStyledButton>`
${styledClass}
`;
const { Text } = Typography;
type TStyledTypographyText = TextProps & IStyledClass;
const StyledTypographyText = styled(Text)<TStyledTypographyText>`
${styledClass}
`;
const { Title } = Typography;
type TStyledTypographyTitle = TitleProps & IStyledClass;
const StyledTypographyTitle = styled(Title)<TStyledTypographyTitle>`
${styledClass}
`;
type TStyledDiv = HTMLAttributes<HTMLDivElement> & IStyledClass;
const StyledDiv = styled.div<TStyledDiv>`
${styledClass}
`;
const StyledTypography = {
Text: StyledTypographyText,
Title: StyledTypographyTitle,
};
export {
StyledButton,
StyledCol,
StyledDiv,
StyledDivider,
StyledRow,
StyledSpace,
StyledTabs,
StyledTypography,
};