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: support compact theme #22126

Merged
merged 31 commits into from
Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
de7ae3e
feat: support narrow theme mode
AshoneA Mar 11, 2020
6568bfe
chore: rename narrow to compact
AshoneA Mar 11, 2020
a2510fa
chore: height part
AshoneA Mar 11, 2020
53be3a1
Merge branch 'feature' into feat/narrow-theme
afc163 Mar 13, 2020
9b767c6
chore: preview compact mode
AshoneA Mar 13, 2020
057532f
chore: to make site corrected
AshoneA Mar 14, 2020
5909a96
chore: preview site
AshoneA Mar 18, 2020
29d6daf
Merge branch 'feature' into feat/narrow-theme
AshoneA Mar 19, 2020
27680f4
Merge branch 'feature' into feat/narrow-theme
AshoneA Mar 20, 2020
dad364c
docs: :book: document compact theme usage
afc163 Mar 20, 2020
75a2c81
Merge branch 'feature' into feat/narrow-theme
afc163 Mar 20, 2020
af08393
docs: tweak theme doc
afc163 Mar 20, 2020
5154bd0
Merge branch 'feature' into feat/narrow-theme
afc163 Mar 20, 2020
327031b
docs: :book: Add description about double css bundle size
afc163 Mar 20, 2020
d75783e
chore: preview
AshoneA Mar 21, 2020
97f778f
chore: for preview
AshoneA Mar 22, 2020
9472090
chore: adjust pagination
AshoneA Mar 22, 2020
f522a84
chore: compact mode done!
AshoneA Mar 23, 2020
6e6c1c5
chore: remove useless todo
AshoneA Mar 23, 2020
210bbff
chore: fix review bug
AshoneA Mar 26, 2020
3059261
chore: fix review bug
AshoneA Mar 27, 2020
9d1ea99
chore: fix card margin
AshoneA Mar 27, 2020
9c6dd65
chore: fix review bug
AshoneA Mar 27, 2020
21c8f34
chore: fix review bug
AshoneA Mar 27, 2020
d08d721
chore: improve i18n and transition
AshoneA Mar 27, 2020
503580c
Update site/theme/static/common.less
AshoneA Mar 27, 2020
6d834e9
chore: fix button size and description padding
AshoneA Mar 28, 2020
0e65ee1
chore: update snapshots
AshoneA Mar 28, 2020
9dddb8e
Merge branch 'feature' into feat/narrow-theme
AshoneA Mar 28, 2020
0174586
chore: add compact css bundlesize limit
AshoneA Mar 28, 2020
a4f35e5
chore: compact dist support
AshoneA Mar 28, 2020
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/alert/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
border-radius: @border-radius-base;

&&-no-icon {
padding: 8px 15px;
padding: @alert-no-icon-padding-vertical 15px;
}

&&-closable {
Expand Down Expand Up @@ -71,7 +71,7 @@

&-close-icon {
position: absolute;
top: 8px;
top: @padding-xs;
right: 16px;
padding: 0;
overflow: hidden;
Expand Down Expand Up @@ -108,7 +108,7 @@
}

&-with-description&-no-icon {
padding: 15px;
padding: @alert-with-description-no-icon-padding-vertical 15px;
}

&-with-description &-icon {
Expand Down
2 changes: 1 addition & 1 deletion components/auto-complete/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
// https://github.com/ant-design/ant-design/issues/22302
.@{select-prefix-cls}-clear {
right: 13px;
}
}
}
2 changes: 1 addition & 1 deletion components/button/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
// To ensure that a space will be placed between character and `Icon`.
> .@{iconfont-css-prefix} + span,
> span + .@{iconfont-css-prefix} {
margin-left: 8px;
margin-left: @margin-xs;
}

&-background-ghost {
Expand Down
16 changes: 13 additions & 3 deletions components/button/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
.button-size(
@btn-height-sm; @btn-padding-horizontal-sm; @btn-font-size-sm; @btn-border-radius-sm
);
line-height: @btn-height-sm - 2px;
}
}
// primary button style
Expand Down Expand Up @@ -370,14 +371,23 @@
// square button: the content only contains icon
.btn-square(@btnClassName: btn) {
.square(@btn-square-size);
.button-size(@btn-square-size; 0; @font-size-base + 2px; @btn-border-radius-base);
.button-size(@btn-square-size; 0; @btn-square-only-icon-size; @btn-border-radius-base);
& > * {
font-size: @btn-square-only-icon-size;
}
&.@{btnClassName}-lg {
.square(@btn-square-size-lg);
.button-size(@btn-square-size-lg; 0; @btn-font-size-lg + 2px; @btn-border-radius-base);
.button-size(@btn-square-size-lg; 0; @btn-square-only-icon-size-lg; @btn-border-radius-base);
& > * {
font-size: @btn-square-only-icon-size-lg;
}
}
&.@{btnClassName}-sm {
.square(@btn-square-size-sm);
.button-size(@btn-square-size-sm; 0; @font-size-base; @btn-border-radius-base);
.button-size(@btn-square-size-sm; 0; @btn-square-only-icon-size-sm; @btn-border-radius-base);
& > * {
font-size: @btn-square-only-icon-size-sm;
}
}
}
// circle button: the content only contains icon
Expand Down
9 changes: 4 additions & 5 deletions components/card/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@import '../../style/mixins/index';

@card-prefix-cls: ~'@{ant-prefix}-card';
@card-head-height: 48px;
@card-hoverable-hover-border: transparent;
@card-action-icon-size: 16px;

Expand Down Expand Up @@ -39,7 +38,7 @@
padding: 0 @card-padding-base;
color: @card-head-color;
font-weight: 500;
font-size: @font-size-lg;
font-size: @card-head-font-size;
background: @card-head-background;
border-bottom: @border-width-base @border-style-base @border-color-split;
border-radius: @card-radius @card-radius 0 0;
Expand All @@ -61,7 +60,7 @@

.@{ant-prefix}-tabs {
clear: both;
margin-bottom: -17px;
margin-bottom: @card-head-tabs-margin-bottom;
color: @text-color;
font-weight: normal;
font-size: @font-size-base;
Expand Down Expand Up @@ -154,7 +153,7 @@

& > li {
float: left;
margin: 12px 0;
margin: @card-actions-li-margin;
color: @text-color-secondary;
text-align: center;

Expand Down Expand Up @@ -236,7 +235,7 @@
&-detail {
overflow: hidden;
> div:not(:last-child) {
margin-bottom: 8px;
margin-bottom: @margin-xs;
}
}

Expand Down
5 changes: 1 addition & 4 deletions components/card/style/size.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@card-head-height-sm: 36px;
@card-padding-base-sm: @card-padding-base / 2;
@card-head-padding-sm: @card-head-padding / 2;
@card-head-font-size-sm: @font-size-base;
@import './index';

.@{card-prefix-cls}-small {
> .@{card-prefix-cls}-head {
Expand Down
2 changes: 1 addition & 1 deletion components/collapse/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ReactDOM.render(
```

<style>
p {
[data-theme="compact"] p, p {
margin: 0;
}
</style>
1 change: 1 addition & 0 deletions components/collapse/demo/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ReactDOM.render(
```

```css
[data-theme='compact'] .site-collapse-custom-collapse .site-collapse-custom-panel,
.site-collapse-custom-collapse .site-collapse-custom-panel {
background: #f7f7f7;
border-radius: 2px;
Expand Down
10 changes: 6 additions & 4 deletions components/comment/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
&-avatar {
position: relative;
flex-shrink: 0;
margin-right: 12px;
margin-right: @margin-sm;
cursor: pointer;

img {
Expand All @@ -36,11 +36,11 @@
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
margin-bottom: 4px;
margin-bottom: @margin-xss;
font-size: @comment-font-size-base;
& > a,
& > span {
padding-right: 8px;
padding-right: @padding-xs;
font-size: @comment-font-size-sm;
line-height: 18px;
}
Expand All @@ -65,12 +65,14 @@
}

&-detail p {
margin-bottom: @comment-content-detail-p-margin-bottom;
white-space: pre-wrap;
}
}

&-actions {
margin-top: 12px;
margin-top: @comment-actions-margin-top;
margin-bottom: @comment-actions-margin-bottom;
padding-left: 0;

> li {
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
.picker-padding(@input-height, @font-size, @padding-horizontal) {
// font height probably 22.0001, So use floor better
@font-height: floor(@font-size * @line-height-base) + 2;
@padding-top: (@input-height - @font-height) / 2;
@padding-bottom: @input-height - @font-height - @padding-top;
@padding-top: max((@input-height - @font-height) / 2, 0);
@padding-bottom: max(@input-height - @font-height - @padding-top, 0);
padding: @padding-top @padding-horizontal @padding-bottom;
}

Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/style/panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,11 @@
.@{picker-prefix-cls}-time-panel-cell-inner {
display: block;
width: 100%;
height: 32px;
height: @picker-time-panel-cell-height;
margin: 0;
padding: 0;
color: @text-color;
line-height: 32px;
line-height: @picker-time-panel-cell-height;
text-align: center;
border-radius: 0;
cursor: pointer;
Expand Down
14 changes: 7 additions & 7 deletions components/descriptions/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

@descriptions-prefix-cls: ~'@{ant-prefix}-descriptions';

@descriptions-default-padding: 16px 24px;
@descriptions-middle-padding: 12px 24px;
@descriptions-small-padding: 8px 16px;
@descriptions-default-padding: @padding-md @padding-lg;
@descriptions-middle-padding: @padding-sm @padding-lg;
@descriptions-small-padding: @padding-xs @padding-md;

.@{descriptions-prefix-cls} {
&-title {
margin-bottom: 20px;
margin-bottom: @descriptions-title-margin-bottom;
color: @heading-color;
font-weight: bold;
font-size: @font-size-lg;
Expand All @@ -29,7 +29,7 @@
&-row {
> th,
> td {
padding-bottom: 16px;
padding-bottom: @padding-md;
}
&:last-child {
border-bottom: none;
Expand Down Expand Up @@ -81,7 +81,7 @@
.@{descriptions-prefix-cls}-row {
> th,
> td {
padding-bottom: 12px;
padding-bottom: @padding-sm;
}
}
}
Expand All @@ -90,7 +90,7 @@
.@{descriptions-prefix-cls}-row {
> th,
> td {
padding-bottom: 8px;
padding-bottom: @padding-xs;
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions components/drawer/demo/basic-right.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ class App extends React.Component {

ReactDOM.render(<App />, mountNode);
```

```css
[data-theme='compact'] .ant-drawer-body p {
margin-bottom: 0px;
}
```
6 changes: 3 additions & 3 deletions components/drawer/style/drawer.less
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@
right: 0;
z-index: @zindex-popup-close;
display: block;
width: 56px;
height: 56px;
width: @drawer-header-close-size;
height: @drawer-header-close-size;
padding: 0;
color: @text-color-secondary;
font-weight: 700;
font-size: @font-size-lg;
font-style: normal;
line-height: 56px;
line-height: @drawer-header-close-size;
text-align: center;
text-transform: none;
text-decoration: none;
Expand Down
3 changes: 3 additions & 0 deletions components/form/demo/advanced-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@ ReactDOM.render(
```

```css
[data-theme='compact'] .ant-advanced-search-form,
.ant-advanced-search-form {
padding: 24px;
background: #fbfbfb;
border: 1px solid #d9d9d9;
border-radius: 2px;
}

[data-theme='compact'] .ant-advanced-search-form .ant-form-item,
.ant-advanced-search-form .ant-form-item {
display: flex;
}

[data-theme='compact'] .ant-advanced-search-form .ant-form-item-control-wrapper,
.ant-advanced-search-form .ant-form-item-control-wrapper {
flex: 1;
}
Expand Down
22 changes: 20 additions & 2 deletions components/input/demo/addon.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import { SettingOutlined } from '@ant-design/icons';
const { Option } = Select;

const selectBefore = (
<Select defaultValue="http://" style={{ width: 90 }}>
<Select defaultValue="http://" className="select-before">
<Option value="http://">http://</Option>
<Option value="https://">https://</Option>
</Select>
);
const selectAfter = (
<Select defaultValue=".com" style={{ width: 80 }}>
<Select defaultValue=".com" className="select-after">
<Option value=".com">.com</Option>
<Option value=".jp">.jp</Option>
<Option value=".cn">.cn</Option>
Expand All @@ -52,3 +52,21 @@ ReactDOM.render(
mountNode,
);
```

```css
.select-before {
width: 90px;
}

.select-after {
width: 80px;
}

[data-theme='compact'] .select-before {
width: 71px;
}

[data-theme='compact'] .select-after {
width: 65px;
}
```
4 changes: 2 additions & 2 deletions components/input/style/allow-clear.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

// ======================= TextArea ========================
.@{ant-prefix}-input-affix-wrapper-textarea-with-clear-btn {
padding: 0;
border: 0;
padding: 0 !important;
border: 0 !important;
}

.@{ant-prefix}-input-textarea-clear-icon {
Expand Down
6 changes: 1 addition & 5 deletions components/layout/demo/fixed.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ ReactDOM.render(
<Layout>
<Header style={{ position: 'fixed', zIndex: 1, width: '100%' }}>
<div className="logo" />
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['2']}
>
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']}>
<Menu.Item key="1">nav 1</Menu.Item>
<Menu.Item key="2">nav 2</Menu.Item>
<Menu.Item key="3">nav 3</Menu.Item>
Expand Down
6 changes: 1 addition & 5 deletions components/layout/demo/top-side-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ ReactDOM.render(
<Layout>
<Header className="header">
<div className="logo" />
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['2']}
>
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']}>
<Menu.Item key="1">nav 1</Menu.Item>
<Menu.Item key="2">nav 2</Menu.Item>
<Menu.Item key="3">nav 3</Menu.Item>
Expand Down
6 changes: 1 addition & 5 deletions components/layout/demo/top-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ ReactDOM.render(
<Layout>
<Header className="header">
<div className="logo" />
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['2']}
>
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']}>
<Menu.Item key="1">nav 1</Menu.Item>
<Menu.Item key="2">nav 2</Menu.Item>
<Menu.Item key="3">nav 3</Menu.Item>
Expand Down
Loading