Skip to content

Commit

Permalink
Merge pull request #3865 from 10up/feature/3851
Browse files Browse the repository at this point in the history
Add tooltips for meta keys to the weighting screen.
  • Loading branch information
felipeelia authored Mar 18, 2024
2 parents c014edc + 7aadce0 commit 22efccb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions assets/js/weighting/components/field.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress Dependencies.
*/
import { Button, CheckboxControl, RangeControl } from '@wordpress/components';
import { Button, CheckboxControl, RangeControl, Tooltip } from '@wordpress/components';
import { WPElement } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { trash } from '@wordpress/icons';
Expand All @@ -14,9 +14,10 @@ import { trash } from '@wordpress/icons';
* @param {Function} props.onChange Change handler.
* @param {Function} props.onDelete Delete handler.
* @param {object} props.value Values.
* @param {boolean} props.showTooltip Whether to show field name tooltip.
* @returns {WPElement} Component element.
*/
export default ({ label, onChange, onDelete, value }) => {
export default ({ label, onChange, onDelete, value, showTooltip }) => {
const { enabled = false, weight = 0 } = value;

/**
Expand Down Expand Up @@ -45,7 +46,15 @@ export default ({ label, onChange, onDelete, value }) => {
return (
<div className="ep-weighting-field">
<fieldset>
<legend className="ep-weighting-field__name">{label}</legend>
<legend className="ep-weighting-field__name">
{showTooltip ? (
<Tooltip text={label}>
<span>{label}</span>
</Tooltip>
) : (
label
)}
</legend>
<div className="ep-weighting-field__searchable">
<CheckboxControl
checked={enabled}
Expand Down
1 change: 1 addition & 0 deletions assets/js/weighting/components/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default ({ group, postType }) => {
onDelete={() => {
onDelete(key);
}}
showTooltip
/>
</PanelRow>
))}
Expand Down

0 comments on commit 22efccb

Please sign in to comment.