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

Save entities panel: update styles #58706

Merged
merged 1 commit into from
Feb 8, 2024
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 @@ -39,10 +39,7 @@ export default function EntityRecordItem( { record, checked, onChange } ) {
<CheckboxControl
__nextHasNoMarginBottom
label={
<strong>
{ decodeEntities( entityRecordTitle ) ||
__( 'Untitled' ) }
</strong>
decodeEntities( entityRecordTitle ) || __( 'Untitled' )
}
checked={ checked }
onChange={ onChange }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getEntityDescription( entity, count ) {
);
case 'page':
case 'post':
return __( 'The following content has been modified.' );
return __( 'The following has been modified.' );
}
}

Expand All @@ -55,18 +55,15 @@ function GlobalStylesDescription( { record } ) {
}
);
return globalStylesChanges.length ? (
<>
<h3 className="entities-saved-states__description-heading">
{ __( 'Changes made to:' ) }
</h3>
<PanelRow>{ globalStylesChanges.join( ', ' ) }.</PanelRow>
</>
<PanelRow className="entities-saved-states__change-summary">
{ globalStylesChanges.join( ', ' ) }.
</PanelRow>
) : null;
}

function EntityDescription( { record, count } ) {
if ( 'globalStyles' === record?.name ) {
return <GlobalStylesDescription record={ record } />;
return null;
}
const description = getEntityDescription( record?.name, count );
return description ? <PanelRow>{ description }</PanelRow> : null;
Expand Down Expand Up @@ -117,6 +114,9 @@ export default function EntityTypeList( {
/>
);
} ) }
{ 'globalStyles' === firstRecord?.name && (
<GlobalStylesDescription record={ firstRecord } />
) }
</PanelBody>
);
}
21 changes: 17 additions & 4 deletions packages/editor/src/components/entities-saved-states/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
* WordPress dependencies
*/
import { Button, Flex, FlexItem } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, _n, sprintf } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { useCallback, useRef } from '@wordpress/element';
import {
useCallback,
useRef,
createInterpolateElement,
} from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
Expand Down Expand Up @@ -215,8 +219,17 @@ export function EntitiesSavedStatesExtensible( {
{ additionalPrompt }
<p>
{ isDirty
? __(
'The following changes have been made to your site, templates, and content.'
? createInterpolateElement(
sprintf(
/* translators: %d: number of site changes waiting to be saved. */
_n(
'There is <strong>%d site change</strong> waiting to be saved.',
'There are <strong>%d site changes</strong> waiting to be saved.',
sortedPartitionedSavables.length
),
sortedPartitionedSavables.length
),
{ strong: <strong /> }
)
: __( 'Select the items you want to save.' ) }
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
.entities-saved-states__description-heading {
font-size: $default-font-size;
}

.entities-saved-states__change-summary {
color: $gray-700;
font-size: $helptext-font-size;
}
Loading