Skip to content

Commit

Permalink
Long slugs breaking summary panel UI (#64053)
Browse files Browse the repository at this point in the history
* fix: long slugs breaking summary panel UI

* refactor: Update styles for post URL to truncate the button when the URL is extremely long

* Addressed feedback

Co-authored-by: amitraj2203 <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: akasunil <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
6 people authored Jul 31, 2024
1 parent b1628c0 commit 1f97f7f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/editor/src/components/post-url/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/
import { useMemo, useState } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { Dropdown, Button } from '@wordpress/components';
import {
Dropdown,
Button,
__experimentalTruncate as Truncate,
} from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { safeDecodeURIComponent } from '@wordpress/url';
import { store as coreStore } from '@wordpress/core-data';
Expand Down Expand Up @@ -86,7 +90,9 @@ function PostURLToggle( { isOpen, onClick } ) {
aria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) }
onClick={ onClick }
>
{ isFrontPage ? postLink : <>/{ decodedSlug }</> }
<Truncate numberOfLines={ 1 }>
{ isFrontPage ? postLink : `/${ decodedSlug }` }
</Truncate>
</Button>
);
}

0 comments on commit 1f97f7f

Please sign in to comment.