Skip to content

Commit 08bd04a

Browse files
committed
Media editor: square corners and W:/H: format on crop dimensions badge
1 parent 7c56a6b commit 08bd04a

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎packages/media-editor/src/components/media-editor-canvas/crop-dimensions-badge.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { CropperState } from '../../image-editor';
1616
* @param height Output crop height in source pixels.
1717
*/
1818
export function formatBadgeText( width: number, height: number ): string {
19-
return `${ Math.round( width ) } × ${ Math.round( height ) }`;
19+
return `W: ${ Math.round( width ) }px H: ${ Math.round( height ) }px`;
2020
}
2121

2222
export interface CropDimensionsBadgeProps {

‎packages/media-editor/src/components/media-editor-canvas/style.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
top: $grid-unit-15;
2323
left: $grid-unit-15;
2424
padding: $grid-unit-05 $grid-unit-10;
25-
border-radius: $radius-full;
25+
border-radius: 0;
2626
background: #fff;
2727
color: $gray-900;
2828
font-size: 11px;

‎packages/media-editor/src/components/media-editor-canvas/test/crop-dimensions-badge.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import { formatBadgeText } from '../crop-dimensions-badge';
55

66
describe( 'formatBadgeText', () => {
7-
it( 'renders integer-rounded dimensions with a multiplication sign', () => {
8-
expect( formatBadgeText( 1240.4, 819.6 ) ).toBe( '1240 × 820' );
7+
it( 'renders integer-rounded dimensions with px-suffixed labels', () => {
8+
expect( formatBadgeText( 1240.4, 819.6 ) ).toBe( 'W: 1240px H: 820px' );
99
} );
1010

1111
it( 'handles whole-pixel dimensions', () => {
12-
expect( formatBadgeText( 500, 333 ) ).toBe( '500 × 333' );
12+
expect( formatBadgeText( 500, 333 ) ).toBe( 'W: 500px H: 333px' );
1313
} );
1414
} );

0 commit comments

Comments
 (0)