ihealth-kit-registration/scripts/genAntdCss.tsx
2023-04-22 23:00:38 +08:00

81 lines
2.0 KiB
TypeScript

import { extractStyle } from '@ant-design/static-style-extract';
import { ConfigProvider } from 'antd';
import fs from 'fs';
import React from 'react';
const outputPath = './src/styles/antd.min.css';
const brandPrimary = '#FF5200';
const textPrimary = '#1E1D1F'
const textDarker = '#000022'
const textLighter = '#8F9296'
const white = '#FDFDFD'
const css = extractStyle((node) => (
<ConfigProvider
theme={{
token: {
colorBgMask: 'rgba(217, 217, 217, 0.65)',
colorLink: brandPrimary,
colorLinkHover: brandPrimary,
colorLinkActive: brandPrimary,
colorPrimary: brandPrimary,
colorText: textPrimary,
colorTextBase: textPrimary,
fontSize: 16,
fontSizeHeading1: 28,
fontSizeHeading2: 22,
fontSizeHeading3: 20,
lineHeightHeading1: 1.3,
lineHeightHeading2: 1.3,
lineHeightHeading3: 1.3,
fontSizeHeading4: 16,
fontFamily: 'Lato, Helvetica, Arial, sans-serif'
},
components: {
Button: {
// button base
fontSize: 20,
borderRadius: 4,
controlHeight: 45,
lineHeight: 45 / 20,
controlOutlineWidth: 0,
controlOutline: 'transparent',
// primary button
colorPrimary: '#FF5A0C',
colorTextLightSolid: white,
colorPrimaryHover: brandPrimary,
colorPrimaryActive: brandPrimary,
// disabled button
colorBgContainerDisabled: '#CACACC',
colorTextDisabled: white,
// text button
colorText: brandPrimary,
colorBgTextHover: 'transparent',
colorBgTextActive: 'transparent',
},
Modal: {
borderRadiusLG: 10,
boxShadow: '2px 2px 4px 1px rgba(0, 0, 0, 0.2)',
paddingContentHorizontalLG: 32,
},
Tooltip: {
fontSize: 14,
paddingSM: 12,
paddingXS: 10,
borderRadius: 4,
colorTextLightSolid: textDarker,
colorBgDefault: white,
},
Steps: {
colorSplit: brandPrimary,
colorTextDescription: textLighter,
}
}
}}
>
{node}
</ConfigProvider>
));
fs.writeFileSync(outputPath, css);