Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Mar 23, 2023
1 parent 397134a commit efebb78
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 56 deletions.
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/global-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ export {
useGlobalSetting,
useGlobalStyle,
useSettingsForBlockElement,
useColorsPerOrigin,
useGradientsPerOrigin,
} from './hooks';
export { useGlobalStylesOutput } from './use-global-styles-output';
export { GlobalStylesContext } from './context';
Expand Down
55 changes: 1 addition & 54 deletions packages/edit-site/src/components/global-styles/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,11 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { unlock } from '../../private-apis';
import { useSelect } from '@wordpress/data';

const {
useGlobalSetting,
useColorsPerOrigin: useColorsPerOriginFromSettings,
useGradientsPerOrigin: useGradientsPerOriginFromSettings,
} = unlock( blockEditorPrivateApis );
const { useGlobalSetting } = unlock( blockEditorPrivateApis );

// Enable colord's a11y plugin.
extend( [ a11yPlugin ] );

export function useColorsPerOrigin( name ) {
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
const [ shouldDisplayDefaultColors ] = useGlobalSetting(
'color.defaultPalette'
);

return useColorsPerOriginFromSettings( {
color: {
palette: {
custom: customColors,
theme: themeColors,
default: defaultColors,
},
defaultPalette: shouldDisplayDefaultColors,
},
} );
}

export function useGradientsPerOrigin( name ) {
const [ customGradients ] = useGlobalSetting(
'color.gradients.custom',
name
);
const [ themeGradients ] = useGlobalSetting(
'color.gradients.theme',
name
);
const [ defaultGradients ] = useGlobalSetting(
'color.gradients.default',
name
);
const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
'color.defaultGradients'
);

return useGradientsPerOriginFromSettings( {
color: {
gradients: {
custom: customGradients,
theme: themeGradients,
default: defaultGradients,
},
defaultGradients: shouldDisplayDefaultGradients,
},
} );
}

export function useColorRandomizer( name ) {
const [ themeColors, setThemeColors ] = useGlobalSetting(
'color.palette.theme',
Expand Down

0 comments on commit efebb78

Please sign in to comment.