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

BorderBoxControl: Add Tooltips around split border controls #42661

Closed
wants to merge 1 commit into from
Closed
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 @@ -9,6 +9,7 @@ import { useMergeRefs } from '@wordpress/compose';
* Internal dependencies
*/
import BorderBoxControlVisualizer from '../border-box-control-visualizer';
import Tooltip from '../../tooltip';
import { BorderControl } from '../../border-control';
import { Grid } from '../../grid';
import { contextConnect, WordPressComponentProps } from '../../ui/context';
Expand Down Expand Up @@ -64,41 +65,62 @@ const BorderBoxControlSplitControls = (
value={ value }
__next36pxDefaultSize={ __next36pxDefaultSize }
/>
<BorderControl
className={ centeredClassName }
hideLabelFromVision={ true }
label={ __( 'Top border' ) }
onChange={ ( newBorder ) => onChange( newBorder, 'top' ) }
__unstablePopoverProps={ popoverProps }
value={ value?.top }
{ ...sharedBorderControlProps }
/>
<BorderControl
hideLabelFromVision={ true }
label={ __( 'Left border' ) }
onChange={ ( newBorder ) => onChange( newBorder, 'left' ) }
__unstablePopoverProps={ popoverProps }
value={ value?.left }
{ ...sharedBorderControlProps }
/>
<BorderControl
className={ rightAlignedClassName }
hideLabelFromVision={ true }
label={ __( 'Right border' ) }
onChange={ ( newBorder ) => onChange( newBorder, 'right' ) }
__unstablePopoverProps={ popoverProps }
value={ value?.right }
{ ...sharedBorderControlProps }
/>
<BorderControl
className={ centeredClassName }
hideLabelFromVision={ true }
label={ __( 'Bottom border' ) }
onChange={ ( newBorder ) => onChange( newBorder, 'bottom' ) }
__unstablePopoverProps={ popoverProps }
value={ value?.bottom }
{ ...sharedBorderControlProps }
/>
<Tooltip text={ __( 'Top border' ) } position="top">
<div className={ centeredClassName }>
<BorderControl
hideLabelFromVision={ true }
label={ __( 'Top border' ) }
onChange={ ( newBorder ) =>
onChange( newBorder, 'top' )
}
__unstablePopoverProps={ popoverProps }
value={ value?.top }
{ ...sharedBorderControlProps }
/>
</div>
</Tooltip>
<Tooltip text={ __( 'Left border' ) } position="top">
<div>
<BorderControl
hideLabelFromVision={ true }
label={ __( 'Left border' ) }
onChange={ ( newBorder ) =>
onChange( newBorder, 'left' )
}
__unstablePopoverProps={ popoverProps }
value={ value?.left }
{ ...sharedBorderControlProps }
/>
</div>
</Tooltip>
<Tooltip text={ __( 'Right border' ) } position="top">
<div className={ rightAlignedClassName }>
<BorderControl
hideLabelFromVision={ true }
label={ __( 'Right border' ) }
onChange={ ( newBorder ) =>
onChange( newBorder, 'right' )
}
__unstablePopoverProps={ popoverProps }
value={ value?.right }
{ ...sharedBorderControlProps }
/>
</div>
</Tooltip>
<Tooltip text={ __( 'Bottom border' ) } position="top">
<div className={ centeredClassName }>
<BorderControl
hideLabelFromVision={ true }
label={ __( 'Bottom border' ) }
onChange={ ( newBorder ) =>
onChange( newBorder, 'bottom' )
}
__unstablePopoverProps={ popoverProps }
value={ value?.bottom }
{ ...sharedBorderControlProps }
/>
</div>
</Tooltip>
</Grid>
);
};
Expand Down