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

Site Editor: Navigation panel add blue dot to customized templates #26894

Closed
wants to merge 7 commits into from
Closed
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 @@ -87,6 +87,17 @@
.edit-site-navigation-panel__template-item {
display: block;

&.is-active {
.edit-site-navigation-panel__template-item-description {
color: $gray-100;
}

.edit-site-navigation-panel__template-item-customized-dot {
background: $white;
}
}

button,
.components-button {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -115,3 +126,22 @@
margin: 0;
}
}

.edit-site-navigation-panel__template-item-title {
display: inline-block;
padding-right: $grid-unit-20;
position: relative;
}

.edit-site-navigation-panel__template-item-customized-dot {
position: absolute;
right: 0;
top: 50%;
margin-top: -$grid-unit-05;
width: $grid-unit-10;
height: $grid-unit-10;
display: block;
background: var(--wp-admin-theme-color);
border-radius: 50%;
cursor: help;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
*/
import {
Button,
Tooltip,
__experimentalNavigationItem as NavigationItem,
} from '@wordpress/components';
import { useDispatch } from '@wordpress/data';
import { useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -37,7 +39,21 @@ export default function TemplateNavigationItem( { item } ) {
onMouseEnter={ () => setIsPreviewVisible( true ) }
onMouseLeave={ () => setIsPreviewVisible( false ) }
>
{ title }
<div className="edit-site-navigation-panel__template-item-title">
{ title }
{ item.type === 'wp_template' &&
item.status !== 'auto-draft' &&
item.file_based && (
<Tooltip
text={ __(
'This theme template has been customized'
) }
position="top center"
>
<span className="edit-site-navigation-panel__template-item-customized-dot" />
</Tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the dot alone is just too small to be an effective hover area for the tooltip.
Maybe it could make sense to wrap the entire title? 🤔

Also the tooltip background seems to me === the sidebar background, making it hard to read.

@jameskoster do you have any opinions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could make sense to wrap the entire title?

That would probably help with the criticism I had below. Its hard to get it to pop up or even know its there, especially with the cursor already being a pointer in the parent.

) }
</div>
{ description && (
<div className="edit-site-navigation-panel__template-item-description">
{ description }
Expand Down