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

feat: dark theme #3410

Merged
merged 6 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/button/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@
}

&-background-ghost {
color: @component-background;
background: transparent !important;
border-color: @component-background;
color: @btn-default-ghost-color;
background: @btn-default-ghost-bg !important;
border-color: @btn-default-ghost-border;
}

&-background-ghost&-primary {
Expand Down
88 changes: 70 additions & 18 deletions components/button/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,30 @@

&:hover,
&:focus {
.button-color(
@color; ~`colorPalette('@{background}', 5) `; ~`colorPalette('@{background}', 5) `
);
& when (@theme = dark) {
.button-color(
@color; ~`colorPalette('@{background}', 7) `; ~`colorPalette('@{background}', 7) `
);
}
& when not (@theme = dark) {
.button-color(
@color; ~`colorPalette('@{background}', 5) `; ~`colorPalette('@{background}', 5) `
);
}
}

&:active,
&.active {
.button-color(
@color; ~`colorPalette('@{background}', 7) `; ~`colorPalette('@{background}', 7) `
);
& when (@theme = dark) {
.button-color(
@color; ~`colorPalette('@{background}', 5) `; ~`colorPalette('@{background}', 5) `
);
}
& when not (@theme = dark) {
.button-color(
@color; ~`colorPalette('@{background}', 7) `; ~`colorPalette('@{background}', 7) `
);
}
}

.button-disabled();
Expand All @@ -52,17 +66,27 @@

&:hover,
&:focus {
.button-color(
~`colorPalette('@{btn-primary-bg}', 5) `; @background; ~`colorPalette('@{btn-primary-bg}', 5)
`
);
& when (@theme = dark) {
.button-color(@primary-5; @background; @primary-5);
}
& when not (@theme = dark) {
.button-color(
~`colorPalette('@{btn-primary-bg}', 5) `; @background;
~`colorPalette('@{btn-primary-bg}', 5) `
);
}
}
&:active,
&.active {
.button-color(
~`colorPalette('@{btn-primary-bg}', 7) `; @background; ~`colorPalette('@{btn-primary-bg}', 7)
`
);
& when (@theme = dark) {
.button-color(@primary-7; @background; @primary-7);
}
& when not (@theme = dark) {
.button-color(
~`colorPalette('@{btn-primary-bg}', 7) `; @background;
~`colorPalette('@{btn-primary-bg}', 7) `
);
}
}
.button-disabled();
}
Expand All @@ -72,19 +96,47 @@
&:hover,
&:focus {
& when (@border = transparent) {
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
& when (@theme = dark) {
.button-color(~`colorPalette('@{color}', 7) `; transparent; transparent);
}
& when not (@theme = dark) {
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
}
}
& when not(@border = transparent) {
.button-color(~`colorPalette('@{color}', 5) `; transparent; ~`colorPalette('@{color}', 5) `);
& when (@theme = dark) {
.button-color(
~`colorPalette('@{color}', 7) `; transparent; ~`colorPalette('@{color}', 7) `
);
}
& when not (@theme = dark) {
.button-color(
~`colorPalette('@{color}', 5) `; transparent; ~`colorPalette('@{color}', 5) `
);
}
}
}
&:active,
&.active {
& when (@border = transparent) {
.button-color(~`colorPalette('@{color}', 7) `; transparent; transparent);
& when (@theme = dark) {
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
}
& when not (@theme = dark) {
.button-color(~`colorPalette('@{color}', 7) `; transparent; transparent);
}
}
& when not(@border = transparent) {
.button-color(~`colorPalette('@{color}', 7) `; transparent; ~`colorPalette('@{color}', 7) `);
& when (@theme = dark) {
.button-color(
~`colorPalette('@{color}', 5) `; transparent; ~`colorPalette('@{color}', 5) `
);
}
& when not (@theme = dark) {
.button-color(
~`colorPalette('@{color}', 7) `; transparent; ~`colorPalette('@{color}', 7) `
);
}
}
}
.button-disabled();
Expand Down
2 changes: 2 additions & 0 deletions components/card/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

&-hoverable {
cursor: pointer;
transition: box-shadow 0.3s border-color 0.3s;

&:hover {
border-color: @card-hover-border;
box-shadow: @card-shadow;
Expand Down
8 changes: 4 additions & 4 deletions components/cascader/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

position: relative;
display: inline-block;
background-color: @component-background;
background-color: @cascader-bg;
border-radius: @border-radius-base;
outline: 0;
cursor: pointer;
Expand Down Expand Up @@ -127,7 +127,7 @@
z-index: @zindex-dropdown;
font-size: @cascader-dropdown-font-size;
white-space: nowrap;
background: @component-background;
background: @cascader-menu-bg;
border-radius: @border-radius-base;
box-shadow: @box-shadow-base;

Expand Down Expand Up @@ -168,7 +168,7 @@
overflow: auto;
vertical-align: top;
list-style: none;
border-right: @border-width-base @border-style-base @border-color-split;
border-right: @border-width-base @border-style-base @cascader-menu-border-color-split;
-ms-overflow-style: -ms-autohiding-scrollbar; // https://github.com/ant-design/ant-design/issues/11857

&:first-child {
Expand Down Expand Up @@ -203,7 +203,7 @@
&,
&:hover {
font-weight: @select-item-selected-font-weight;
background-color: @background-color-light;
background-color: @cascader-item-selected-bg;
}
}
&-expand {
Expand Down
2 changes: 1 addition & 1 deletion components/checkbox/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
display: block;
width: @checkbox-size;
height: @checkbox-size;
background-color: @checkbox-check-color;
background-color: @checkbox-check-bg;
border: @checkbox-border-width @border-style-base @border-color-base;
border-radius: @border-radius-sm;
// Fix IE checked style
Expand Down
1 change: 1 addition & 0 deletions components/comment/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

.@{comment-prefix-cls} {
position: relative;
background-color: @comment-bg;

&-inner {
display: flex;
Expand Down
3 changes: 3 additions & 0 deletions components/date-picker/style/Calendar.less
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
background-color: @component-background;
background-clip: padding-box;
border: @border-width-base @border-style-base @border-color-inverse;
& when (@theme = dark) {
border-color: @black;
}
border-radius: @border-radius-base;
outline: none;
box-shadow: @box-shadow-base;
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/style/Picker.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
z-index: 2;
color: @disabled-color;
font-size: @font-size-base;
background: @input-bg;
background: @component-background;
cursor: pointer;
opacity: 0;
pointer-events: none;
Expand Down
12 changes: 6 additions & 6 deletions components/divider/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,33 @@
&-horizontal&-with-text-left {
&::before {
top: 50%;
width: 5%;
width: @divider-orientation-margin;
}
&::after {
top: 50%;
width: 95%;
width: 100% - @divider-orientation-margin;
}
}

&-horizontal&-with-text-right {
&::before {
top: 50%;
width: 95%;
width: 100% - @divider-orientation-margin;
}
&::after {
top: 50%;
width: 5%;
width: @divider-orientation-margin;
}
}

&-inner-text {
display: inline-block;
padding: 0 24px;
padding: 0 @divider-text-padding;
}

&-dashed {
background: none;
border-color: @border-color-split;
border-color: @divider-color;
border-style: dashed;
border-width: 1px 0 0;
}
Expand Down
6 changes: 3 additions & 3 deletions components/drawer/style/drawer.less
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
position: relative;
z-index: 1;
overflow: auto;
background-color: @component-background;
background-color: @drawer-bg;
background-clip: padding-box;
border: 0;
}
Expand Down Expand Up @@ -181,14 +181,14 @@
position: relative;
padding: @drawer-header-padding;
color: @text-color;
background: @component-background;
background: @drawer-bg;
border-bottom: @border-width-base @border-style-base @border-color-split;
border-radius: @border-radius-base @border-radius-base 0 0;
}

&-header-no-title {
color: @text-color;
background: @component-background;
background: @drawer-bg;
}

&-body {
Expand Down
11 changes: 7 additions & 4 deletions components/dropdown/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

&::before {
position: absolute;
top: -7px;
top: -@popover-distance + @popover-arrow-width;
right: 0;
bottom: -7px;
bottom: -@popover-distance + @popover-arrow-width;
left: -7px;
z-index: -9999;
opacity: 0.0001;
Expand Down Expand Up @@ -52,7 +52,7 @@
padding: @dropdown-edge-child-vertical-padding 0;
text-align: left;
list-style-type: none;
background-color: @component-background;
background-color: @dropdown-menu-bg;
background-clip: padding-box;
border-radius: @border-radius-base;
outline: none;
Expand Down Expand Up @@ -111,6 +111,9 @@
padding: @dropdown-vertical-padding @control-padding-horizontal;
color: @text-color;
transition: all 0.3s;
&:hover {
color: @text-color;
}
}

&:first-child {
Expand Down Expand Up @@ -192,7 +195,7 @@
&,
.@{dropdown-prefix-cls}-menu-submenu-arrow-icon {
color: @disabled-color;
background-color: @component-background;
background-color: @dropdown-menu-submenu-disabled-bg;
cursor: not-allowed;
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/empty/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defaultConfigProvider } from '../config-provider';

const Simple = () => {
const { getPrefixCls } = inject('configProvider', defaultConfigProvider);
const prefixCls = getPrefixCls('empty-img-default');
const prefixCls = getPrefixCls('empty-img-simple');

return (
<svg class={prefixCls} width="64" height="41" viewBox="0 0 64 41">
Expand Down
2 changes: 1 addition & 1 deletion components/input/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
transition: all 0.3s;

&:hover {
color: #333;
color: @input-icon-hover-color;
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/input/style/search-input.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
cursor: pointer;
transition: all 0.3s;
&:hover {
color: fade(@black, 80%);
color: @input-icon-hover-color;
}
}

Expand Down
8 changes: 4 additions & 4 deletions components/list/__tests__/__snapshots__/empty.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ exports[`List renders empty list 1`] = `
<div class="ant-spin-container">
<div class="ant-list-empty-text">
<div class="ant-empty ant-empty-normal">
<div class="ant-empty-image"><svg class="ant-empty-img-default" width="64" height="41" viewBox="0 0 64 41">
<div class="ant-empty-image"><svg class="ant-empty-img-simple" width="64" height="41" viewBox="0 0 64 41">
<g transform="translate(0 1)" fill="none" fill-rule="evenodd">
<ellipse class="ant-empty-img-default-ellipse" fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"></ellipse>
<g class="ant-empty-img-default-g" fill-rule="nonzero" stroke="#D9D9D9">
<ellipse class="ant-empty-img-simple-ellipse" fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"></ellipse>
<g class="ant-empty-img-simple-g" fill-rule="nonzero" stroke="#D9D9D9">
<path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path>
<path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" fill="#FAFAFA" class="ant-empty-img-default-path"></path>
<path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" fill="#FAFAFA" class="ant-empty-img-simple-path"></path>
</g>
</g>
</svg></div>
Expand Down
Loading