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(radio): Use new ripple mixins, and remove unnecessary mixin #1476

Merged
merged 2 commits into from
Oct 26, 2017
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
3 changes: 2 additions & 1 deletion demos/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@import "./common";
@import "../packages/mdc-form-field/mdc-form-field";
@import "../packages/mdc-radio/mdc-radio";
@import "../packages/mdc-ripple/mixins";
@import "../packages/mdc-theme/color-palette";
@import "../packages/mdc-typography/mdc-typography";

Expand All @@ -27,5 +28,5 @@
@include mdc-radio-checked-stroke-color($color);
@include mdc-radio-ink-color($material-color-orange-500);
@include mdc-radio-focus-indicator-color($color);
@include mdc-radio-ripple((base-color: $color));
@include mdc-ripple-color($color, $mdc-radio-ripple-opacity);
}
3 changes: 1 addition & 2 deletions packages/mdc-radio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,8 @@ Mixin | Description
`mdc-radio-checked-stroke-color($color)` | Sets the stroke color of a checked radio
`mdc-radio-ink-color($color)` | Sets the ink color
`mdc-radio-focus-indicator-color($color)` | Sets the color of the focus indicator
`mdc-radio-ripple-color($ripple-config)` | Sets the ripple to the given [ripple configuration][ripple-readme]

[ripple-readme]: https://github.com/material-components/material-components-web/blob/master/packages/mdc-ripple/README.md
The ripple effect for the Radio Button component is styled using [MDC Ripple](../mdc-ripple) mixins.

### Caveat: Edge and CSS Variables

Expand Down
7 changes: 0 additions & 7 deletions packages/mdc-radio/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,3 @@
@include mdc-theme-prop(background-color, $color, $edgeOptOut: true);
}
}

@mixin mdc-radio-ripple($ripple-config) {
$ripple-config: map-merge((opacity: $mdc-radio-ripple-opacity, radius: 50%), $ripple-config);

@include mdc-ripple-bg(map-merge($ripple-config, (pseudo: "::before")));
@include mdc-ripple-fg(map-merge($ripple-config, (pseudo: "::after")));
}
1 change: 1 addition & 0 deletions packages/mdc-radio/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ $mdc-radio-ui-size: 20px;
$mdc-radio-ui-pct: percentage($mdc-radio-ui-size / $mdc-radio-touch-area);
$mdc-radio-transition-duration: 120ms;
$mdc-radio-ripple-opacity: .14;
$mdc-radio-ripple-radius: 50%;
$mdc-radio-baseline-theme-color: secondary;
5 changes: 3 additions & 2 deletions packages/mdc-radio/mdc-radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

// postcss-bem-linter: define radio
.mdc-radio {
@include mdc-ripple-base;
@include mdc-radio-unchecked-stroke-color(text-secondary-on-light);

@include mdc-theme-dark {
Expand All @@ -33,7 +32,9 @@
@include mdc-radio-checked-stroke-color($mdc-radio-baseline-theme-color);
@include mdc-radio-ink-color($mdc-radio-baseline-theme-color);
@include mdc-radio-focus-indicator-color($mdc-radio-baseline-theme-color);
@include mdc-radio-ripple((theme-style: $mdc-radio-baseline-theme-color));
@include mdc-ripple-surface;
@include mdc-ripple-color($mdc-radio-baseline-theme-color, $mdc-radio-ripple-opacity);
@include mdc-ripple-radius($mdc-radio-ripple-radius);

display: inline-block;
position: relative;
Expand Down