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

add: Typography mixins. add: Created typography variables (margin, fo… #18746

Merged
merged 5 commits into from Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions components/style/mixins/index.less
Expand Up @@ -7,3 +7,4 @@
@import 'motion';
@import 'reset';
@import 'operation-unit';
@import 'typography';
59 changes: 59 additions & 0 deletions components/style/mixins/typography.less
@@ -0,0 +1,59 @@
// =============== Common ===============
.typography-paragraph() {
margin-bottom: 1em;
}

.typography-title(@fontSize; @fontWeight; @lineHeight; @headingColor; @headingMarginRight; @headingMarginBottom; @headingMarginLeft) {
margin-right: @headingMarginRight;
margin-bottom: @headingMarginBottom;
margin-left: @headingMarginLeft;
color: @headingColor;
font-weight: @fontWeight;
font-size: @fontSize;
line-height: @lineHeight;
}

.typography-title-1() {
.typography-title(
@heading-1-size,
@typography-title-font-weight,
1.23,
@heading-color,
@typography-title-margin-right,
@typography-title-margin-bottom,
@typography-title-margin-left
mucluck marked this conversation as resolved.
Show resolved Hide resolved
);
}
.typography-title-2() {
.typography-title(
@heading-2-size,
@typography-title-font-weight,
1.35,
@heading-color,
@typography-title-margin-right,
@typography-title-margin-bottom,
@typography-title-margin-left
);
}
.typography-title-3() {
.typography-title(
@heading-3-size,
@typography-title-font-weight,
1.35,
@heading-color,
@typography-title-margin-right,
@typography-title-margin-bottom,
@typography-title-margin-left
);
}
.typography-title-4() {
.typography-title(
@heading-4-size,
@typography-title-font-weight,
1.4,
@heading-color,
@typography-title-margin-right,
@typography-title-margin-bottom,
@typography-title-margin-left
);
}
4 changes: 4 additions & 0 deletions components/style/themes/default.less
Expand Up @@ -681,3 +681,7 @@
// Typography
// ---
@typography-title-font-weight: 600;
@typography-title-margin-top: 1.2em;
mucluck marked this conversation as resolved.
Show resolved Hide resolved
@typography-title-margin-right: 0;
Copy link
Member

Choose a reason for hiding this comment

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

We don't need @typography-title-margin-right and @typography-title-margin-left, drop them and make it hard coded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then it will be impossible to use the margin in the theming. Why do you need to hardcode this? My projects require margin.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any neccessary of setting margin-left and margin-right to headings, could you point out for me by examples?

@typography-title-margin-bottom: 0.5em;
@typography-title-margin-left: 0;
27 changes: 0 additions & 27 deletions components/typography/style/index.less
Expand Up @@ -2,33 +2,6 @@
@import '../../style/mixins/index';

@typography-prefix-cls: ~'@{ant-prefix}-typography';
@typography-title-margin-top: 1.2em;

// =============== Common ===============
.typography-paragraph() {
margin-bottom: 1em;
}

.typography-title(@fontSize; @lineHeight) {
margin-bottom: 0.5em;
color: @heading-color;
font-weight: @typography-title-font-weight;
font-size: @fontSize;
line-height: @lineHeight;
}

.typography-title-1() {
.typography-title(@heading-1-size, 1.23);
}
.typography-title-2() {
.typography-title(@heading-2-size, 1.35);
}
.typography-title-3() {
.typography-title(@heading-3-size, 1.35);
}
.typography-title-4() {
.typography-title(@heading-4-size, 1.4);
}

// =============== Basic ===============
.@{typography-prefix-cls} {
Expand Down