Skip to content

Commit 4b7847e

Browse files
bg-fill-button: move inline styles to CSS (jakearchibald#324)
* bg-fill-button: move inline styles to CSS * Alternative solution * Alternative * Update src/js/page/ui/bg-fill-button.js Co-authored-by: Jake Archibald <[email protected]> * prettier * Update src/css/_utils.scss Co-authored-by: Jake Archibald <[email protected]> * Update _utils.scss Co-authored-by: Jake Archibald <[email protected]>
1 parent c0ba123 commit 4b7847e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/css/_utils.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ $easeInOutSine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
3030
$easeInOutExpo: cubic-bezier(1, 0, 0, 1);
3131
$easeInOutCirc: cubic-bezier(0.785, 0.135, 0.15, 0.86);
3232
$easeInOutBack: cubic-bezier(0.68, -0.55, 0.265, 1.55);
33+
34+
.bg-dark {
35+
background-color: rgba(0, 0, 0, 0.7);
36+
}

src/js/page/ui/bg-fill-button.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ export default class BgFillButton extends FloatingActionButton {
1616

1717
onClick(event) {
1818
super.onClick(event);
19-
// event adds a background color
19+
2020
if (this.container.classList.contains('active')) {
2121
this.container.classList.remove('active');
22-
this.setColor('transparent');
22+
document.documentElement.classList.remove('bg-dark');
2323
} else {
2424
this.container.classList.add('active');
25-
this.setColor('rgba(0, 0, 0, 0.7)');
25+
document.documentElement.classList.add('bg-dark');
2626
}
2727
}
28-
29-
setColor(color) {
30-
document.documentElement.style.backgroundColor = color;
31-
}
3228
}

0 commit comments

Comments
 (0)