Skip to content

Commit

Permalink
fix(codemod): token priority should be #ffffff > #fff
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Oct 29, 2023
1 parent 2b5e2cf commit 097f35b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
background: #52c41a;
background-color: #faad14;
border-color: #ff4D4F;
scrollbar-color: #ffffff;
.content {
color: rgba(0, 0, 0, 0.85);
background: rgba(0, 0, 0,0.65);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
background: @colorSuccess;
background-color: @colorWarning;
border-color: @colorError;
scrollbar-color: @colorBgContainer;
.content {
color: @colorText;
background: @colorTextSecondary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Demo = () => {
return (
<div>
<Alert style={{ color: 'rgba(0, 0, 0, 0.85)', background: 'rgba(0, 0, 0,0.65)', backgroundColor: 'rgba(0,0,0,0.45)', border: '1px solid #d9d9d9' }} />
<Button style={{ color: '#1890ff', background: '#52c41a', backgroundColor: '#faad14', borderColor: '#ff4D4F' }}></Button>
<Button style={{ color: '#1890ff', background: '#52c41a', backgroundColor: '#faad14', borderColor: '#ff4D4F', scrollbarColor: '#ffffff' }}></Button>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Demo = () => {
return (
(<div>
<Alert style={{ color: token.colorText, background: token.colorTextSecondary, backgroundColor: token.colorTextTertiary, border: `1px solid ${token.colorBorder}` }} />
<Button style={{ color: token.colorInfo, background: token.colorSuccess, backgroundColor: token.colorWarning, borderColor: token.colorError }}></Button>
<Button style={{ color: token.colorInfo, background: token.colorSuccess, backgroundColor: token.colorWarning, borderColor: token.colorError, scrollbarColor: token.colorBgContainer }}></Button>
</div>)
);
};
Expand Down
3 changes: 2 additions & 1 deletion packages/codemod/transforms/utils/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const TOKEN_MAP = {
'#bfbfbf': 'colorBorder',
'#f0f2f5': 'colorBgLayout',
'#fafafa': 'colorBgLayout',
'#fff': 'colorBgContainer',
// priority should be #ffffff > #fff to avoid bad case: '#ffffff' => `${token.colorBgContainer}fff`
'#ffffff': 'colorBgContainer',
'#fff': 'colorBgContainer',
'rgba(0,0,0,0.85)': 'colorText',
'rgba(0,0,0,0.65)': 'colorTextSecondary',
'rgba(0,0,0,0.45)': 'colorTextTertiary',
Expand Down

0 comments on commit 097f35b

Please sign in to comment.