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

Commit

Permalink
chore(slider): remove dark theme (#2099)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removed `$mdc-slider-dark-theme-assumed-bg-color` from
slider variables.
  • Loading branch information
Matty Goo authored Jan 30, 2018
1 parent fff8153 commit e1ea223
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 56 deletions.
20 changes: 0 additions & 20 deletions demos/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,11 @@
--mdc-slider-bg-color-behind-component: #f2f2f2;
}

.mdc-theme--dark {
background-color: #333;
}

.custom-bg {
background-color: #eee;
--mdc-slider-bg-color-behind-component: #eee;
}

.mdc-theme--dark.custom-bg {
background-color: #102027;
--mdc-slider-bg-color-behind-component: #102027;
}

.slider-example {
margin-bottom: 48px;
}
Expand Down Expand Up @@ -235,10 +226,6 @@ <h2>Custom Colored Discrete Slider with Tick Marks</h2>
<input type="checkbox" name="disabled">
Disabled
</label>
<label class="demo-param-field">
<input type="checkbox" name="dark-theme">
Dark Theme
</label>
<label class="demo-param-field">
<input type="checkbox" name="use-custom-color">
Use Custom BG Color
Expand All @@ -264,7 +251,6 @@ <h2>Custom Colored Discrete Slider with Tick Marks</h2>
var minInput = demoRoot.querySelector('[name="min"]');
var maxInput = demoRoot.querySelector('[name="max"]');
var step = demoRoot.querySelector('[name="step"]');
var darkTheme = demoRoot.querySelector('[name="dark-theme"]');
var disabled = demoRoot.querySelector('[name="disabled"]');
var useCustomColor = demoRoot.querySelector('[name="use-custom-color"]');
var rtl = demoRoot.querySelector('[name="rtl"]');
Expand Down Expand Up @@ -346,12 +332,6 @@ <h2>Custom Colored Discrete Slider with Tick Marks</h2>
customDiscreteWMarkerSlider.step = stepValue;
});

darkTheme.addEventListener('change', function() {
[].forEach.call(demoRoot.querySelectorAll('.example-slider-wrapper'), function(example) {
example.classList[ darkTheme.checked ? 'add' : 'remove']('mdc-theme--dark');
});
});

disabled.addEventListener('change', function() {
continuousSlider.disabled = disabled.checked;
discreteSlider.disabled = disabled.checked;
Expand Down
4 changes: 0 additions & 4 deletions demos/slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@
@include mdc-slider-thumb-color($material-color-orange-500);
@include mdc-slider-focus-halo-color($material-color-yellow-900);
@include mdc-slider-value-pin-fill-color-accessible($material-color-pink-500);

@include mdc-theme-dark {
@include mdc-slider-rail-tick-mark-color(black);
}
}
14 changes: 1 addition & 13 deletions packages/mdc-slider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ use to build a custom MDCSlider component for their framework.

### Theming

By default, all thematic elements of sliders make use of the **secondary theme color**, including when the
component is used within a dark mode context.
By default, all thematic elements of sliders make use of the **secondary theme color**.

#### Sass Mixins

Expand Down Expand Up @@ -318,17 +317,6 @@ the color specified:
}
```

If you need to accomplish this in a browser which does not support custom properties (IE11 and
older versions of Edge), you can override the Sass variables `$mdc-slider-default-assumed-bg-color`.

```scss
$mdc-slider-default-assumed-bg-color: #fafafa;

@import "@material/slider/mdc-slider";
```

If you're using the `.mdc-theme--dark` classes, you'll want to override `$mdc-slider-dark-theme-assumed-bg-color` instead.

### Tips/Tricks

#### Preventing [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content)
Expand Down
3 changes: 0 additions & 3 deletions packages/mdc-slider/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@
// limitations under the License.
//

$mdc-slider-default-assumed-bg-color: white !default;
$mdc-slider-dark-theme-assumed-bg-color: #333 !default;

$mdc-slider-baseline-rail-opacity: .26;
22 changes: 6 additions & 16 deletions packages/mdc-slider/mdc-slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.
//

@import "@material/theme/mixins";
@import "@material/typography/mixins";
@import "@material/rtl/mixins";
@import "./keyframes";
Expand All @@ -27,24 +26,15 @@
@include mdc-slider-color-accessible(secondary);

&--disabled {
$light-color: #9a9a9a;
$dark-color: #787878;
$disabled-color: #9a9a9a;

@include mdc-slider-highlight-color_($light-color);
@include mdc-slider-rail-color_($light-color);
@include mdc-slider-rail-tick-mark-color_($light-color);
@include mdc-slider-thumb-color_($light-color);
@include mdc-slider-thumb-stroke-cutout_($mdc-slider-default-assumed-bg-color);
@include mdc-slider-highlight-color_($disabled-color);
@include mdc-slider-rail-color_($disabled-color);
@include mdc-slider-rail-tick-mark-color_($disabled-color);
@include mdc-slider-thumb-color_($disabled-color);
@include mdc-slider-thumb-stroke-cutout_(white);

cursor: auto;

@include mdc-theme-dark(".mdc-slider", true) {
@include mdc-slider-highlight-color_($dark-color);
@include mdc-slider-rail-color_($dark-color);
@include mdc-slider-rail-tick-mark-color_($dark-color);
@include mdc-slider-thumb-color_($dark-color);
@include mdc-slider-thumb-stroke-cutout_($mdc-slider-dark-theme-assumed-bg-color);
}
}

position: relative;
Expand Down

0 comments on commit e1ea223

Please sign in to comment.