Skip to content

Commit

Permalink
refactor: adjust boxShadow token (ant-design#40516)
Browse files Browse the repository at this point in the history
* refactor: adjust boxShadow token

* chore: code clean
  • Loading branch information
MadCcc authored and RedJue committed Apr 25, 2023
1 parent 325afc8 commit af7a258
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 15 deletions.
4 changes: 2 additions & 2 deletions components/card/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const genCardStyle: GenerateStyle<CardToken> = (token): CSSObject => {
cardShadow,
cardHeadPadding,
colorBorderSecondary,
boxShadow,
boxShadowTertiary,
cardPaddingBase,
} = token;

Expand All @@ -241,7 +241,7 @@ const genCardStyle: GenerateStyle<CardToken> = (token): CSSObject => {
borderRadius: token.borderRadiusLG,

[`&:not(${componentCls}-bordered)`]: {
boxShadow,
boxShadow: boxShadowTertiary,
},

[`${componentCls}-head`]: genCardHeadStyle(token),
Expand Down
4 changes: 2 additions & 2 deletions components/message/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const genMessageStyle: GenerateStyle<MessageToken> = (token) => {
const {
componentCls,
iconCls,
boxShadowSecondary,
boxShadow,
colorBgElevated,
colorSuccess,
colorError,
Expand Down Expand Up @@ -128,7 +128,7 @@ const genMessageStyle: GenerateStyle<MessageToken> = (token) => {
padding: messageNoticeContentPadding,
background: colorBgElevated,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
boxShadow,
pointerEvents: 'all',
},

Expand Down
2 changes: 1 addition & 1 deletion components/modal/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const genModalStyle: GenerateStyle<ModalToken> = (token) => {
backgroundClip: 'padding-box',
border: 0,
borderRadius: token.borderRadiusLG,
boxShadow: token.boxShadowSecondary,
boxShadow: token.boxShadow,
pointerEvents: 'auto',
padding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`,
},
Expand Down
4 changes: 2 additions & 2 deletions components/notification/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
const {
iconCls,
componentCls, // .ant-notification
boxShadowSecondary,
boxShadow,
fontSizeLG,
notificationMarginBottom,
borderRadiusLG,
Expand Down Expand Up @@ -165,7 +165,7 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
wordWrap: 'break-word',
background: notificationBg,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
boxShadow,

[`${componentCls}-close-icon`]: {
fontSize,
Expand Down
2 changes: 1 addition & 1 deletion components/segmented/style/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function getItemDisabledStyle(cls: string, token: SegmentedToken): CSSObject {
function getItemSelectedStyle(token: SegmentedToken): CSSObject {
return {
backgroundColor: token.bgColorSelected,
boxShadow: token.boxShadow,
boxShadow: token.boxShadowTertiary,
};
}

Expand Down
2 changes: 1 addition & 1 deletion components/tabs/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const genDropdownStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject
backgroundClip: 'padding-box',
borderRadius: token.borderRadiusLG,
outline: 'none',
boxShadow: token.boxShadow,
boxShadow: token.boxShadowTertiary,

'&-item': {
...textEllipsis,
Expand Down
1 change: 1 addition & 0 deletions components/theme/interface/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface AliasToken extends MapToken {

boxShadow: string;
boxShadowSecondary: string;
boxShadowTertiary: string;

linkDecoration: React.CSSProperties['textDecoration'];
linkHoverDecoration: React.CSSProperties['textDecoration'];
Expand Down
11 changes: 8 additions & 3 deletions components/theme/util/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ export default function formatToken(derivativeToken: RawMergedToken): AliasToken
marginXXL: mergedToken.sizeXXL,

boxShadow: `
0 1px 2px 0 rgba(0, 0, 0, 0.03),
0 1px 6px -1px rgba(0, 0, 0, 0.02),
0 2px 4px 0 rgba(0, 0, 0, 0.02)
0 6px 16px 0 rgba(0, 0, 0, 0.08),
0 3px 6px -4px rgba(0, 0, 0, 0.12),
0 9px 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowSecondary: `
0 6px 16px 0 rgba(0, 0, 0, 0.08),
0 3px 6px -4px rgba(0, 0, 0, 0.12),
0 9px 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowTertiary: `
0 1px 2px 0 rgba(0, 0, 0, 0.03),
0 1px 6px -1px rgba(0, 0, 0, 0.02),
0 2px 4px 0 rgba(0, 0, 0, 0.02)
`,

screenXS,
screenXSMin: screenXS,
Expand Down
6 changes: 3 additions & 3 deletions components/tour/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const genBaseStyle: GenerateStyle<TourToken> = (token) => {
colorFill,
sliderHeight,
sliderWidth,
boxShadow,
boxShadowTertiary,
tourZIndexPopup,
fontSize,
colorBgContainer,
Expand Down Expand Up @@ -74,7 +74,7 @@ const genBaseStyle: GenerateStyle<TourToken> = (token) => {
textAlign: 'start',
textDecoration: 'none',
borderRadius: tourBorderRadius,
boxShadow,
boxShadow: boxShadowTertiary,
position: 'relative',
backgroundColor: colorBgContainer,
border: 'none',
Expand Down Expand Up @@ -165,7 +165,7 @@ const genBaseStyle: GenerateStyle<TourToken> = (token) => {
textDecoration: 'none',
backgroundColor: colorPrimary,
borderRadius,
boxShadow,
boxShadow: boxShadowTertiary,

[`${componentCls}-close`]: {
color: colorTextLightSolid,
Expand Down

0 comments on commit af7a258

Please sign in to comment.