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

Add tooltips for meta keys to the weighting screen. #3865

Merged
merged 1 commit into from
Mar 18, 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
Add tooltips for meta keys to the weighting screen.
  • Loading branch information
JakePT committed Mar 17, 2024
commit 7aadce058037418c5f71c0d36a59e7d8231ca720
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
Loading