Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

chore(typography): Remove the adjust margin feature #2464

Merged
merged 6 commits into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 1 addition & 7 deletions packages/mdc-typography/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,20 @@ CSS Class | Description
`mdc-typography--body1` | Sets font properties as Body 1
`mdc-typography--caption` | Sets font properties as Caption
`mdc-typography--button` | Sets font properties as Button
`mdc-typography--adjust-margin` | Positions text, used in conjunction with font classes above

> **A note about `mdc-typography--adjust-margin`**, `mdc-typography--adjust-margin` will change the margin properties of the element it is applied to, to align text correctly. `mdc-typography--adjust-margin` should only be used in a text context; using this property on UI elements such as buttons may cause them to be positioned incorrectly.

### Sass Variables and Mixins

Mixin | Description
--- | ---
`mdc-typography-base` | Sets the font to Roboto
`mdc-typography($style)` | Applies one of the typography styles, including setting the font to Roboto
`mdc-typography-adjust-margin($style)` | Positions text
`mdc-typography-overflow-ellipsis` | Truncates overflow text to one line with an ellipsis

> **A note about `mdc-typography-adjust-margin`**, `mdc-typography-adjust-margin` will change the margin properties of the element it is applied to, to align text correctly. `mdc-typography-adjust-margin` should only be used in a text context; using this property on UI elements such as buttons may cause them to be positioned incorrectly.

> **A note about `mdc-typography-overflow-ellipsis`**, `mdc-typography-overflow-ellipsis` should only be used if the element is `display: block` or `display: inline-block`.

#### `$style` Values

These styles can be used as the `$style` argument for `mdc-typography` and `mdc-typography-adjust-margin` mixins.
These styles can be used as the `$style` argument for `mdc-typography` mixins.
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix wording: These styles can be used as the $style argument for the mdc-typography mixin.


* `display4`
* `display3`
Expand Down
6 changes: 0 additions & 6 deletions packages/mdc-typography/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@

@include mdc-typography-base;

$style-props: map-remove($style-props, margin);

@each $key, $value in $style-props {
#{$key}: $value;
}
}

@mixin mdc-typography-adjust-margin($style) {
margin: map-get(map-get($mdc-typography-styles, $style), margin);
}

// Element must be `display: block` or `display: inline-block` for this to work.
@mixin mdc-typography-overflow-ellipsis {
text-overflow: ellipsis;
Expand Down
12 changes: 0 additions & 12 deletions packages/mdc-typography/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ $mdc-typography-styles: (
line-height: 7rem, /* 112sp */
font-weight: map-get($mdc-typography-font-weight-values, light),
letter-spacing: -.04em,
margin: -1rem 0 3.5rem -.085em /* -16sp 0 56sp -.085em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -44,7 +43,6 @@ $mdc-typography-styles: (
line-height: 3.5rem, /* 56px */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: -.02em,
margin: -8px 0 64px -.07em,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -53,7 +51,6 @@ $mdc-typography-styles: (
line-height: 3rem, /* 48px */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: normal,
margin: -.5rem 0 4rem -.07em /* -8sp 0 64sp -.07em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -62,7 +59,6 @@ $mdc-typography-styles: (
line-height: 2.5rem, /* 40sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: normal,
margin: -.5rem 0 4rem -.07em /* -8sp 0 64sp -.07em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -71,7 +67,6 @@ $mdc-typography-styles: (
line-height: 2rem, /* 32sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: normal,
margin: -.5rem 0 1rem -.06em /* -8sp 0 16sp -.06em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -80,7 +75,6 @@ $mdc-typography-styles: (
line-height: 2rem, /* 32sp */
font-weight: map-get($mdc-typography-font-weight-values, medium),
letter-spacing: .02em,
margin: -.5rem 0 1rem -.05em /* -8sp 0 16sp -.05em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -89,7 +83,6 @@ $mdc-typography-styles: (
line-height: 1.75rem, /* 28sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: .04em,
margin: -.5rem 0 1rem -.06em /* -8sp 0 16sp -.06em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -98,7 +91,6 @@ $mdc-typography-styles: (
line-height: 1.5rem, /* 24sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: .04em,
margin: -.313rem 0 .813rem -.06em /* -5sp 0 13sp -.06em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -107,7 +99,6 @@ $mdc-typography-styles: (
line-height: 1.5rem, /* 24sp */
font-weight: map-get($mdc-typography-font-weight-values, medium),
letter-spacing: .04em,
margin: -.25rem 0 .75rem 0 /* -4sp 0 12sp 0 */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -116,7 +107,6 @@ $mdc-typography-styles: (
line-height: 1.25rem, /* 20sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: .04em,
margin: -.25rem 0 .75rem 0 /* -4sp 0 12sp 0 */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -125,7 +115,6 @@ $mdc-typography-styles: (
line-height: 1.25rem, /* 20sp */
font-weight: map-get($mdc-typography-font-weight-values, regular),
letter-spacing: .08em,
margin: -.5rem 0 1rem -.04em /* -8sp 0 16sp -.04em */,
text-decoration: inherit,
text-transform: inherit
),
Expand All @@ -134,7 +123,6 @@ $mdc-typography-styles: (
line-height: 2.25rem, /* 36sp */
font-weight: map-get($mdc-typography-font-weight-values, medium),
letter-spacing: .04em,
margin: inherit /* We do not have adjust margin for button */,
text-decoration: none,
text-transform: uppercase
)
Expand Down
4 changes: 0 additions & 4 deletions packages/mdc-typography/mdc-typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@
.mdc-typography--#{$style} {
@include mdc-typography($style);
}

.mdc-typography--adjust-margin.mdc-typography--#{$style} {
@include mdc-typography-adjust-margin($style);
}
}