Skip to content

Commit 694a027

Browse files
committed
feat(with-without): continued theming
1 parent b0f62aa commit 694a027

File tree

4 files changed

+181
-122
lines changed

4 files changed

+181
-122
lines changed

packages/components/bolt-with-without/SimpleSwitch.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $simple-switch_focus-ring-size: 7px !default;
44
$simple-switch_handle-color: bolt-color('teal', 'light') !default;
55
$simple-switch_outline-size: 4px !default;
66
// this is just a default value/fallback for older browsers
7-
$simple-switch_size: 155px !default;
7+
$simple-switch_size: 175px !default;
88
// @TODO make this be the animation tokens
99
$simple-switch_switch-speed: 250ms !default;
1010
$simple-switch_tray-color: bolt-color('white') !default;

packages/components/bolt-with-without/js/with-without.js

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,21 @@ const SimpleSwitch = require('a-simple-switch');
77
*
88
* @return {void}
99
*/
10-
const setActiveRegion = (checked, shouldToggleAnimations) => {
10+
const setActiveRegion = (checked) => {
1111
const activeWoClass = 'c-pega-wwo__active-wo';
1212
const activeWClass = 'c-pega-wwo__active-w';
1313
const mainWrapper = document.querySelector('.c-pega-wwo__wrapper');
1414
mainWrapper.classList.add(checked ? activeWClass : activeWoClass);
1515
mainWrapper.classList.remove(checked ? activeWoClass : activeWClass);
1616
};
1717

18-
// const toggleAnimations = (classToActivate, classToDeactivate) => {
19-
// const animationClasses = ['c-pega-wwo__sm-circle'];
20-
// const animationAttribute = 'data-anim-triggered';
21-
// animationClasses.forEach((animationClass) => {
22-
// const activateEl = document.querySelector(`.${classToActivate} .${animationClass}`);
23-
// if (activateEl) {
24-
// activateEl.setAttribute(animationAttribute, 'yes');
25-
// }
26-
// const deActivateEl = document.querySelector(`.${classToDeactivate} .${animationClass}`);
27-
// if (deActivateEl) {
28-
// deActivateEl.setAttribute(animationAttribute, 'yes');
29-
// }
30-
// });
31-
// };
32-
33-
window.onload = () => {
34-
setTimeout(() => {
35-
const toggleInputClass = '#c-pega-wwo__toggle-input';
36-
SimpleSwitch.init();
37-
setActiveRegion(document.querySelector(toggleInputClass).checked);
38-
document
39-
.querySelector('#c-pega-wwo__toggle-input')
40-
.addEventListener('change', e => {
41-
setActiveRegion(e.target.checked);
42-
});
43-
}, 4000);
44-
};
18+
setTimeout(() => {
19+
const toggleInputClass = '#c-pega-wwo__toggle-input';
20+
SimpleSwitch.init();
21+
setActiveRegion(document.querySelector(toggleInputClass).checked);
22+
document
23+
.querySelector('#c-pega-wwo__toggle-input')
24+
.addEventListener('change', e => {
25+
setActiveRegion(e.target.checked);
26+
});
27+
}, 0);

0 commit comments

Comments
 (0)