-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4a80b0
commit 0e539ea
Showing
7 changed files
with
150 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import type { CSSObject } from '@ant-design/cssinjs'; | ||
import type { FullToken } from 'antd/es/theme/internal'; | ||
|
||
export const genCompactStyle = (componentCls: string, subComponentCls: string = ''): CSSObject => { | ||
return { | ||
[`&${componentCls}-compact-item:not(${componentCls}-compact-last-item)${componentCls}-compact-first-item ${subComponentCls}`]: | ||
{ | ||
borderStartEndRadius: 0, | ||
borderEndEndRadius: 0, | ||
}, | ||
[`&${componentCls}-compact-item:not(${componentCls}-compact-first-item):not(${componentCls}-compact-last-item) ${subComponentCls}`]: | ||
{ | ||
borderRadius: 0, | ||
}, | ||
[`&${componentCls}-compact-item:not(${componentCls}-compact-first-item)${componentCls}-compact-last-item ${subComponentCls}`]: | ||
{ | ||
borderStartStartRadius: 0, | ||
borderEndStartRadius: 0, | ||
}, | ||
}; | ||
}; | ||
|
||
export const genLargeStyle = (token: FullToken<any>): CSSObject => { | ||
const { | ||
antCls, | ||
iconCls, | ||
fontSize, | ||
lineWidth, | ||
borderRadiusLG, | ||
controlHeight, | ||
controlHeightSM, | ||
controlHeightLG, | ||
} = token; | ||
const height = controlHeightLG; | ||
const lineHeight = `${controlHeightLG}px`; | ||
|
||
return { | ||
// Button | ||
[`${antCls}-btn`]: { | ||
// limit min width for icon button | ||
minWidth: controlHeightLG, | ||
height, | ||
fontSize, | ||
borderRadius: borderRadiusLG, | ||
// Button in Space.Compact | ||
...genCompactStyle(`${antCls}-btn`), | ||
}, | ||
// Radio.Button | ||
[`${antCls}-radio-group`]: { | ||
[`${antCls}-radio-button-wrapper`]: { | ||
height, | ||
lineHeight: `${height - lineWidth * 2}px`, | ||
fontSize, | ||
[`&:first-child`]: { | ||
borderStartStartRadius: borderRadiusLG, | ||
borderEndStartRadius: borderRadiusLG, | ||
}, | ||
[`&:last-child`]: { | ||
borderStartEndRadius: borderRadiusLG, | ||
borderEndEndRadius: borderRadiusLG, | ||
}, | ||
}, | ||
}, | ||
// Select | ||
[`${antCls}-select`]: { | ||
height, | ||
fontSize, | ||
// Select in Space.Compact | ||
...genCompactStyle(`${antCls}-select`, `${antCls}-select-selector`), | ||
[`${antCls}-select-selector`]: { | ||
borderRadius: borderRadiusLG, | ||
}, | ||
[`${antCls}-select-selection-item`]: { | ||
fontSize, | ||
}, | ||
}, | ||
// Input | ||
[`${antCls}-input-wrapper`]: { | ||
fontSize, | ||
[`${iconCls}`]: { | ||
fontSize, | ||
}, | ||
[`${antCls}-input-affix-wrapper`]: { | ||
borderStartEndRadius: 0, | ||
borderEndEndRadius: 0, | ||
}, | ||
}, | ||
[`${antCls}-input-affix-wrapper`]: { | ||
height, | ||
borderRadius: borderRadiusLG, | ||
[`&:not(${antCls}-input-affix-wrapper-lg)`]: { | ||
lineHeight: `${controlHeight - lineWidth * 2}px`, | ||
}, | ||
// avoid to conflict with `${antCls}-input-affix-wrapper` height | ||
[`${antCls}-input`]: { | ||
height: `${controlHeight - lineWidth * 2}px`, | ||
}, | ||
[`${antCls}-input-lg`]: { | ||
height: controlHeightSM, | ||
}, | ||
[`${antCls}-input-sm`]: { | ||
height: `${controlHeightLG - lineWidth * 2}px`, | ||
}, | ||
}, | ||
[`${antCls}-input`]: { | ||
height, | ||
fontSize, | ||
borderRadius: borderRadiusLG, | ||
// Input in Space.Compact | ||
...genCompactStyle(`${antCls}-input`), | ||
}, | ||
[`${antCls}-input-search-button`]: { | ||
height, | ||
lineHeight, | ||
borderStartEndRadius: borderRadiusLG, | ||
borderEndEndRadius: borderRadiusLG, | ||
}, | ||
[`${antCls}-input-group-addon`]: { | ||
fontSize, | ||
borderStartEndRadius: borderRadiusLG, | ||
borderEndEndRadius: borderRadiusLG, | ||
}, | ||
// set large DatePicker, TimePicker and RangePicker style | ||
[`${antCls}-picker`]: { | ||
height, | ||
borderRadius: borderRadiusLG, | ||
...genCompactStyle(`${antCls}-picker`), | ||
[`${antCls}-picker-input>input`]: { | ||
fontSize, | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters