Skip to content
Prev Previous commit
Next Next commit
Update the logic to be simpler
This was already refactored in #19778, but didn't need to remain that complicated.
  • Loading branch information
jeherve committed Mar 4, 2022
commit e26a5f09eda7e428e6a1fa49b280651c1ea7c7b4
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import MediaSources from './media-sources';
function MediaButtonMenu( props ) {
const { mediaProps, open, setSelectedSource, isFeatured, isReplace, hasImage } = props;
const originalComponent = mediaProps.render;
let isPrimary = isFeatured;
let isSecondary = false;
let isTertiary = ! isFeatured;
let variant = 'tertiary';

if ( isReplace ) {
return (
Expand All @@ -39,9 +37,7 @@ function MediaButtonMenu( props ) {

if ( isFeatured ) {
label = __( 'Replace Image', 'jetpack' );
isPrimary = false;
isTertiary = false;
isSecondary = true;
variant = 'secondary';
}

return (
Expand All @@ -60,9 +56,7 @@ function MediaButtonMenu( props ) {
}
return (
<Button
isPrimary={ isPrimary }
isSecondary={ isSecondary }
isTertiary={ isTertiary }
variant={ variant }
className="jetpack-external-media-button-menu"
aria-haspopup="true"
aria-expanded={ isOpen }
Expand Down