Skip to content

Commit

Permalink
Chore: Remove anonymous components from global styles sidebar (#26604)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Oct 30, 2020
1 parent 7982ce7 commit a5a8bd0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';

export default ( { contextName, getSetting, setSetting } ) => {
export default function ColorPalettePanel( {
contextName,
getSetting,
setSetting,
} ) {
const colors = getSetting( contextName, 'color.palette' );
let emptyUI;
if ( colors === undefined ) {
Expand Down Expand Up @@ -37,4 +41,4 @@ export default ( { contextName, getSetting, setSetting } ) => {
emptyUI={ emptyUI }
/>
);
};
}
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/sidebar/color-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { __ } from '@wordpress/i18n';
import { LINK_COLOR, useEditorFeature } from '../editor/utils';
import ColorPalettePanel from './color-palette-panel';

export default ( {
export default function ColorPanel( {
context: { supports, name },
getStyleProperty,
setStyleProperty,
getSetting,
setSetting,
} ) => {
} ) {
const colors = useEditorFeature( 'color.palette', name );
const disableCustomColors = ! useEditorFeature( 'color.custom', name );
const gradients = useEditorFeature( 'color.gradients', name );
Expand Down Expand Up @@ -98,4 +98,4 @@ export default ( {
/>
</PanelColorGradientSettings>
);
};
}
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/sidebar/default-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
ComplementaryAreaMoreMenuItem,
} from '@wordpress/interface';

export default ( {
export default function DefaultSidebar( {
className,
identifier,
title,
icon,
children,
closeLabel,
header,
} ) => {
} ) {
return (
<>
<ComplementaryArea
Expand All @@ -37,4 +37,4 @@ export default ( {
</ComplementaryAreaMoreMenuItem>
</>
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ import { GLOBAL_CONTEXT } from '../editor/utils';
import TypographyPanel from './typography-panel';
import ColorPanel from './color-panel';

export default ( { identifier, title, icon, closeLabel } ) => {
export default function GlobalStylesSidebar( {
identifier,
title,
icon,
closeLabel,
} ) {
const {
contexts,
getStyleProperty,
Expand Down Expand Up @@ -178,4 +183,4 @@ export default ( { identifier, title, icon, closeLabel } ) => {
</TabPanel>
</DefaultSidebar>
);
};
}
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/sidebar/typography-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { __ } from '@wordpress/i18n';
*/
import { useEditorFeature } from '../editor/utils';

export default ( {
export default function TypographyPanel( {
context: { supports, name },
getStyleProperty,
setStyleProperty,
} ) => {
} ) {
const fontSizes = useEditorFeature( 'typography.fontSizes', name );
const disableCustomFontSizes = ! useEditorFeature(
'typography.customFontSize',
Expand Down Expand Up @@ -50,4 +50,4 @@ export default ( {
) }
</PanelBody>
);
};
}

0 comments on commit a5a8bd0

Please sign in to comment.