Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore]: Update create order form style #22

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/shared/lib/data/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const FilterFormRowLayout = {
export const ANTD_PREFIX_STR = 'antd-v5';

export const ComponentControlHeight = {
default: 32,
default: 36,
lg: 36,
sm: 28
};
Expand Down
55 changes: 25 additions & 30 deletions packages/sqle/src/page/Order/SQLStatementForm/UploadType.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SQLInputType } from '.';
import { IconOrderFileUpload, IconOrderSQLUpload } from '../../../icon/Order';
import { useTranslation } from 'react-i18next';
import { Row, Col } from 'antd5';
import UploadTypeItem from './UploadTypeItem';
import { UploadTypeStyleWrapper } from './style';

const UploadType: React.FC<{
value?: SQLInputType;
Expand All @@ -11,35 +11,30 @@ const UploadType: React.FC<{
}> = ({ value, onChange, hideUpdateMybatisFile = false }) => {
const { t } = useTranslation();
return (
<Row gutter={12}>
<Col span={8}>
<UploadTypeItem
onClick={() => onChange?.(SQLInputType.manualInput)}
active={value === SQLInputType.manualInput}
>
<IconOrderSQLUpload />
<span className="text">{t('order.sqlInfo.manualInput')}</span>
</UploadTypeItem>
</Col>
<Col span={8}>
<UploadTypeItem
active={value === SQLInputType.uploadFile}
onClick={() => onChange?.(SQLInputType.uploadFile)}
>
<IconOrderFileUpload />
<span className="text">{t('order.sqlInfo.uploadFile')}</span>
</UploadTypeItem>
</Col>
<Col span={8} hidden={hideUpdateMybatisFile}>
<UploadTypeItem
active={value === SQLInputType.uploadMybatisFile}
onClick={() => onChange?.(SQLInputType.uploadMybatisFile)}
>
<IconOrderFileUpload />
<span className="text">{t('order.sqlInfo.updateMybatisFile')}</span>
</UploadTypeItem>
</Col>
</Row>
<UploadTypeStyleWrapper>
<UploadTypeItem
onClick={() => onChange?.(SQLInputType.manualInput)}
active={value === SQLInputType.manualInput}
>
<IconOrderSQLUpload />
<span className="text">{t('order.sqlInfo.manualInput')}</span>
</UploadTypeItem>
<UploadTypeItem
active={value === SQLInputType.uploadFile}
onClick={() => onChange?.(SQLInputType.uploadFile)}
>
<IconOrderFileUpload />
<span className="text">{t('order.sqlInfo.uploadFile')}</span>
</UploadTypeItem>
<UploadTypeItem
active={value === SQLInputType.uploadMybatisFile}
onClick={() => onChange?.(SQLInputType.uploadMybatisFile)}
hidden={hideUpdateMybatisFile}
>
<IconOrderFileUpload />
<span className="text">{t('order.sqlInfo.updateMybatisFile')}</span>
</UploadTypeItem>
</UploadTypeStyleWrapper>
);
};

Expand Down
19 changes: 11 additions & 8 deletions packages/sqle/src/page/Order/SQLStatementForm/UploadTypeItem.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { ReactNode } from 'react';
import { UploadItemTypeStyleWrapper } from './style';
import { IconOrderUploadTypeChecked } from '../../../icon/Order';
import { EmptyBox } from '@actiontech/shared';

const UploadTypeItem: React.FC<{
active: boolean;
onClick: () => void;
children: ReactNode;
}> = ({ active, onClick, children }) => {
hidden?: boolean;
}> = ({ active, onClick, children, hidden }) => {
return (
<UploadItemTypeStyleWrapper active={active} onClick={onClick}>
<UploadItemTypeStyleWrapper
active={active}
onClick={onClick}
className="update-type-item-wrapper"
hidden={hidden}
>
{children}
<EmptyBox if={active}>
<div className="active-icon-wrapper">
<IconOrderUploadTypeChecked className="active-icon" />
</div>
</EmptyBox>
<div className="active-icon-wrapper" hidden={!active}>
<IconOrderUploadTypeChecked className="active-icon" />
</div>
</UploadItemTypeStyleWrapper>
);
};
Expand Down
6 changes: 5 additions & 1 deletion packages/sqle/src/page/Order/SQLStatementForm/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import { styled } from '@mui/material/styles';
export const UploadTypeStyleWrapper = styled('div')`
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;

.update-type-item-wrapper:not(:first-of-type) {
margin-left: 12px;
}
`;

export const UploadItemTypeStyleWrapper = styled('div')<{ active?: boolean }>`
flex: 1 0 30%;
background-color: ${({ theme }) =>
theme.sharedTheme.uiToken.colorFillQuaternary};
border: 1px solid
Expand Down
Loading