2023-07-25 11:44:59 +08:00
|
|
|
import React, { Suspense } from 'react';
|
2023-07-28 16:17:43 +08:00
|
|
|
import { Skeleton } from 'antd';
|
2024-04-06 16:11:17 +08:00
|
|
|
import { createStyles } from 'antd-style';
|
2019-08-13 14:07:17 +08:00
|
|
|
|
2023-07-25 11:44:59 +08:00
|
|
|
const IconSearch = React.lazy(() => import('./IconSearch'));
|
2018-09-01 14:05:47 +08:00
|
|
|
|
2024-04-06 16:11:17 +08:00
|
|
|
const useStyle = createStyles(({ token, css }) => ({
|
2023-07-25 11:44:59 +08:00
|
|
|
searchWrapper: css`
|
|
|
|
display: flex;
|
|
|
|
gap: 16px;
|
|
|
|
> *:first-child {
|
|
|
|
flex: 0 0 328px;
|
|
|
|
}
|
|
|
|
> *:last-child {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
fallbackWrapper: css`
|
2023-01-11 21:37:12 +08:00
|
|
|
display: flex;
|
2023-07-25 11:44:59 +08:00
|
|
|
flex-wrap: wrap;
|
2023-01-11 21:37:12 +08:00
|
|
|
justify-content: space-between;
|
2023-07-25 11:44:59 +08:00
|
|
|
> * {
|
|
|
|
flex: 0 0 15%;
|
2024-04-06 16:11:17 +08:00
|
|
|
margin: ${token.marginXXS}px 0;
|
2023-07-25 11:44:59 +08:00
|
|
|
}
|
2023-01-11 21:37:12 +08:00
|
|
|
`,
|
2023-07-25 11:44:59 +08:00
|
|
|
skeletonWrapper: css`
|
|
|
|
text-align: center;
|
2023-01-11 21:37:12 +08:00
|
|
|
|
2023-07-25 11:44:59 +08:00
|
|
|
> * {
|
|
|
|
width: 100% !important;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
}));
|
2018-09-01 14:05:47 +08:00
|
|
|
|
2024-04-06 16:11:17 +08:00
|
|
|
const IconSearchFallback: React.FC = () => {
|
2023-07-20 19:27:33 +08:00
|
|
|
const { styles } = useStyle();
|
2023-01-04 18:49:55 +08:00
|
|
|
|
2022-08-04 10:04:37 +08:00
|
|
|
return (
|
2023-07-25 11:44:59 +08:00
|
|
|
<>
|
|
|
|
<div className={styles.searchWrapper}>
|
|
|
|
<Skeleton.Button active style={{ width: '100%', height: 40 }} />
|
|
|
|
<Skeleton.Input active style={{ width: '100%', height: 40 }} />
|
|
|
|
</div>
|
|
|
|
<Skeleton.Button active style={{ margin: '28px 0 10px', width: 100 }} />
|
|
|
|
<div className={styles.fallbackWrapper}>
|
|
|
|
{Array(24)
|
|
|
|
.fill(1)
|
|
|
|
.map((_, index) => (
|
|
|
|
<div key={index} className={styles.skeletonWrapper}>
|
|
|
|
<Skeleton.Node active style={{ height: 110, width: '100%' }}>
|
|
|
|
{' '}
|
|
|
|
</Skeleton.Node>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</>
|
2022-08-04 10:04:37 +08:00
|
|
|
);
|
|
|
|
};
|
2018-09-01 16:16:11 +08:00
|
|
|
|
2023-07-25 11:44:59 +08:00
|
|
|
export default () => (
|
|
|
|
<Suspense fallback={<IconSearchFallback />}>
|
|
|
|
<IconSearch />
|
|
|
|
</Suspense>
|
|
|
|
);
|