Skip to content

Commit 313228f

Browse files
author
Mario Aguiar
authored
Merge pull request #445 from material-components/fix/443
Move dark mode to plugin; init dark mode early
2 parents 4b060e4 + e7d4961 commit 313228f

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

plugin/assets/src/customizer/customize-preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
*/
4141
import { STYLES } from './components/google-fonts-control/styles';
4242
import { setConfig } from '../block-editor/utils/get-config';
43-
import { applyRgbValue } from '../../../../theme/assets/src/helper/apply-rgb-value';
43+
import { applyRgbValue } from '../helper/apply-rgb-value';
4444

4545
const getIconFontName = iconStyle => {
4646
return iconStyle === 'filled'

theme/assets/src/front-end/components/dark-mode-switch.js renamed to plugin/assets/src/front-end/dark-mode-switch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
themeFromSourceColor,
2424
applyTheme,
2525
} from '@material/material-color-utilities';
26-
import { applyRgbValue } from '../../helper/apply-rgb-value';
26+
import { applyRgbValue } from '../helper/apply-rgb-value';
2727

2828
const body = document.body;
2929
export const ICONS = {

plugin/assets/src/front-end/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from '../common/mdc-components-init';
2929
import { initContactForm } from './contact-form';
3030
import { masonryInit } from './masonry';
31+
import { initDarkModeSwitch } from './dark-mode-switch';
3132

3233
addEventListener( 'DOMContentLoaded', () => {
3334
initButtons();
@@ -45,3 +46,5 @@ addEventListener( 'DOMContentLoaded', () => {
4546
initTextFields();
4647
}
4748
} );
49+
50+
initDarkModeSwitch();
File renamed without changes.

theme/assets/src/customizer/customize-preview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import { debounce } from 'lodash';
3333
* Internal dependencies
3434
*/
3535
import { masonryInit } from '../front-end/components/masonry';
36-
import { ICONS as SWITCHER_ICONS } from '../front-end/components/dark-mode-switch';
36+
37+
import { ICONS as SWITCHER_ICONS } from '../../../../plugin/assets/src/front-end/dark-mode-switch';
3738

3839
export const COLOR_MODES = {
3940
default: 'default',

theme/assets/src/front-end/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { tabBarInit } from './components/tab-bar';
2525
import { embedsInit } from './components/embeds';
2626
import { widgetsInit } from './components/widgets';
2727
import { masonryInit } from './components/masonry';
28-
import { initDarkModeSwitch } from './components/dark-mode-switch';
2928
import './components/navigation';
3029
import './components/skip-link-focus-fix';
3130

@@ -46,5 +45,4 @@ document.addEventListener( 'DOMContentLoaded', () => {
4645
embedsInit();
4746
widgetsInit();
4847
masonryInit();
49-
initDarkModeSwitch();
5048
} );

0 commit comments

Comments
 (0)