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

refactor: input support cssinjs #34288

Merged
merged 30 commits into from
Mar 9, 2022
Merged

refactor: input support cssinjs #34288

merged 30 commits into from
Mar 9, 2022

Conversation

MadCcc
Copy link
Member

@MadCcc MadCcc commented Mar 3, 2022

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Input support cssinjs
🇨🇳 Chinese Input 组件支持 cssinjs

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2022

@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #34288 (d5a8f3f) into next (46e40df) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              next    #34288   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          431       431           
  Lines         7936      7946   +10     
  Branches      2281      2282    +1     
=========================================
+ Hits          7936      7946   +10     
Impacted Files Coverage Δ
components/_util/theme/index.tsx 100.00% <ø> (ø)
components/_util/theme/util/index.tsx 100.00% <100.00%> (ø)
components/input/Group.tsx 100.00% <100.00%> (ø)
components/input/Input.tsx 100.00% <100.00%> (ø)
components/typography/Typography.tsx 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99c2b1a...d5a8f3f. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2022

Size Change: -1.4 kB (0%)

Total Size: 948 kB

Filename Size Change
./dist/antd-with-locales.min.js 385 kB +2.6 kB (+1%)
./dist/antd.compact.min.css 57.2 kB -1.68 kB (-3%)
./dist/antd.dark.min.css 58.6 kB -1.68 kB (-3%)
./dist/antd.min.css 57.2 kB -1.68 kB (-3%)
./dist/antd.min.js 332 kB +2.71 kB (+1%)
./dist/antd.variable.min.css 57.9 kB -1.68 kB (-3%)

compressed-size-action

@MadCcc MadCcc marked this pull request as ready for review March 4, 2022 09:54
@MadCcc MadCcc mentioned this pull request Mar 4, 2022
opacity: 1,
},
'&::placeholder': {
color: new TinyColor({ h: 0, s: 0, v: '75%' }).toHexString(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcode 部分加个 // FIXME

@@ -69,6 +70,10 @@ export interface DerivativeToken extends Omit<DesignToken, 'duration'> {

// TMP
tmpPrimaryHoverColorWeak: string;
tmpBackgroundLight: string;
tmpPaddingSM: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个变量有的

@@ -69,6 +70,10 @@ export interface DerivativeToken extends Omit<DesignToken, 'duration'> {

// TMP
tmpPrimaryHoverColorWeak: string;
tmpBackgroundLight: string;
tmpPaddingSM: number;
tmpTextColorSecondary: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个变量有的

</ConfigConsumer>
);
const Group: React.FC<GroupProps> = props => {
const { getPrefixCls, direction } = useContext(ConfigContext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useContext 不能在 cssinjs 里改,到 master 里改

borderColor: token.inputBorderHoverColor,
borderRightWidth: token.borderWidth,

[`.${prefixCls}-rtl &`]: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTL 全部用逻辑位置代替:https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties

不要出现 left 和 right

borderStyle: token.borderStyle,
borderColor: token.borderColor,
borderRadius: token.borderRadius,
transition: `all 0.3s`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.3stoken.duration 代替

//
//@import './search-input';
//@import './rtl';
//@import './IE11';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议删掉。

top: '8px',
right: '8px',
insetBlockStart: '8px',
insetInlineEnd: '8px',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来还有这个。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该是可以通过 token.paddingXXX 得到的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});

export const genActiveStyle = (theme: any, token: InputToken) => ({
borderColor: theme === 'dark' ? token.inputBorderActiveColor : token.inputBorderHoverColor,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要了


export const genActiveStyle = (theme: any, token: InputToken) => ({
borderColor: theme === 'dark' ? token.inputBorderActiveColor : token.inputBorderHoverColor,
boxShadow: `0 0 0 2px ${new TinyColor(token.inputBorderActiveColor).setAlpha(0.2)}`, // FIXME: outlineFade outlineWidth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outline width 有变量可用

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 高亮这个也有变量可以用


// Undo padding and float of grid classes
[`&[class*='col-']`]: {
paddingInlineEnd: '8px', // FIXME: magic number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接 token.paddingXXXX ?


'&&-compact': {
display: 'block',
// .clearfix(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clearFix 是不是该有个 util?

},
[`&.${prefixCls}-sm`]: {
height: token.controlHeightSM,
paddingTop: 3,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlHeightSmall ?

},

'&-show-count-has-suffix': {
marginInlineEnd: '2px',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME,另外不用 px,数字即可


[`> .${prefixCls}-group`]: {
[`> .${prefixCls}-group-addon:last-child`]: {
insetInlineStart: '-1px',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1


const inputToken: InputToken = {
...token,
inputAffixMargin: 4,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token.marginXXXXX 代替

display: 'table',
clear: 'both',
content: '""',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 flex 以后应该不太需要 clearFix 了。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这个还要不

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没 float 就不需要了

@MadCcc MadCcc merged commit 228d451 into next Mar 9, 2022
@MadCcc MadCcc deleted the refactor/cssinjs-for-input branch March 9, 2022 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants