Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global styles variations: refactor directory structure #59491

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import ColorVariations from './variations-color';
import ColorVariations from './variations/variations-color';
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';

const { useGlobalSetting } = unlock( blockEditorPrivateApis );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { speak } from '@wordpress/a11y';
/**
* Internal dependencies
*/
import { useBlockVariations } from './variations-panel';
import { useBlockVariations } from './variations/variations-panel';
import ScreenHeader from './header';
import { NavigationButtonAsItem } from './navigation-button';
import { unlock } from '../../lock-unlock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import ScreenHeader from './header';
import BlockPreviewPanel from './block-preview-panel';
import { unlock } from '../../lock-unlock';
import Subtitle from './subtitle';
import { useBlockVariations, VariationsPanel } from './variations-panel';
import {
useBlockVariations,
VariationsPanel,
} from './variations/variations-panel';

function applyFallbackStyle( border ) {
if ( ! border ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import ScreenHeader from './header';
import Palette from './palette';
import { unlock } from '../../lock-unlock';
import ColorVariations from './variations-color';
import ColorVariations from './variations/variations-color';
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSelect } from '@wordpress/data';
* Internal dependencies
*/
import TypographyElements from './typography-elements';
import TypographyVariations from './variations-typography';
import TypographyVariations from './variations/variations-typography';
import FontFamilies from './font-families';
import ScreenHeader from './header';
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import StylesPreview from './preview';
import Variation from './variation';
import Variation from './variations/variation';

export default function StyleVariationsContainer() {
const variations = useSelect( ( select ) => {
Expand Down
45 changes: 0 additions & 45 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,45 +91,6 @@
margin: 0;
}

.edit-site-global-styles-variations_item {
box-sizing: border-box;
// To round the outline in Windows 10 high contrast mode.
border-radius: $radius-block-ui;
cursor: pointer;

.edit-site-global-styles-variations_item-preview {
padding: $border-width * 2;
border-radius: $radius-block-ui;
box-shadow: 0 0 0 $border-width $gray-200;
// Shown in Windows 10 high contrast mode.
outline: 1px solid transparent;

.edit-site-global-styles-color-variations & {
padding: $grid-unit-10;
}
}

&.is-active .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 $border-width $gray-900;
// Shown in Windows 10 high contrast mode.
outline-width: 3px;
}

&:hover .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}

&:focus .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}

&:focus-visible {
// Shown in Windows 10 high contrast mode.
outline: 3px solid transparent;
outline-offset: 0;
}
}

.edit-site-global-styles-icon-with-current-color {
fill: currentColor;
}
Expand Down Expand Up @@ -204,9 +165,3 @@
.edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
fill: currentColor;
}

.edit-site-global-styles-type-preview {
font-size: 22px;
line-height: 44px;
text-align: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.edit-site-global-styles-variations_item {
box-sizing: border-box;
// To round the outline in Windows 10 high contrast mode.
border-radius: $radius-block-ui;
cursor: pointer;

.edit-site-global-styles-variations_item-preview {
padding: $border-width * 2;
border-radius: $radius-block-ui;
box-shadow: 0 0 0 $border-width $gray-200;
// Shown in Windows 10 high contrast mode.
outline: 1px solid transparent;

.edit-site-global-styles-color-variations & {
padding: $grid-unit-10;
}
}

&.is-active .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 $border-width $gray-900;
// Shown in Windows 10 high contrast mode.
outline-width: 3px;
}

&:hover .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}

&:focus .edit-site-global-styles-variations_item-preview {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}

&:focus-visible {
// Shown in Windows 10 high contrast mode.
outline: 3px solid transparent;
outline-offset: 0;
}
}

.edit-site-global-styles-variations__type-preview {
font-size: 22px;
line-height: 44px;
text-align: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import { mergeBaseAndUserConfigs } from './global-styles-provider';
import { unlock } from '../../lock-unlock';
import { mergeBaseAndUserConfigs } from '../global-styles-provider';
import { unlock } from '../../../lock-unlock';

const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
blockEditorPrivateApis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import Subtitle from './subtitle';
import Subtitle from '../subtitle';
import Variation from './variation';
import StylesPreviewColors from './preview-colors';
import StylesPreviewColors from '../preview-colors';

export default function ColorVariations( { variations } ) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
* Internal dependencies
*/

import { NavigationButtonAsItem } from './navigation-button';
import { NavigationButtonAsItem } from '../navigation-button';

function getCoreBlockStyles( blockStyles ) {
return blockStyles?.filter( ( style ) => style.source === 'block' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import { mergeBaseAndUserConfigs } from './global-styles-provider';
import { unlock } from '../../lock-unlock';
import { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
import Subtitle from './subtitle';
import { mergeBaseAndUserConfigs } from '../global-styles-provider';
import { unlock } from '../../../lock-unlock';
import { getFamilyPreviewStyle } from '../font-library-modal/utils/preview-styles';
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
import Subtitle from '../subtitle';
import Variation from './variation';

const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
Expand Down Expand Up @@ -72,7 +72,7 @@ const TypePreview = ( { variation } ) => {
: {};
return (
<motion.div
className="edit-site-global-styles-type-preview"
className="edit-site-global-styles-variations__type-preview"
animate={ {
scale: 1,
opacity: 1,
Expand Down
1 change: 1 addition & 0 deletions packages/edit-site/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@import "./hooks/push-changes-to-global-styles/style.scss";
@import "./components/global-styles/font-library-modal/style.scss";
@import "./components/pagination/style.scss";
@import "./components/global-styles/variations/style.scss";

body.js #wpadminbar {
display: none;
Expand Down
Loading