Skip to content

Commit

Permalink
Customize widgets, edit post: refactor Button to new sizes (#65807)
Browse files Browse the repository at this point in the history
* Customize widgets, edit post: refactor Button usages to new component sizing

* Update snapshots

* Switch to compact size in the customize widgets welcome guide

* Remove unused classnames, update snapshots

---

Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Oct 2, 2024
1 parent 559391a commit bed3a43
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ import { doAction } from '@wordpress/hooks';
function CopyButton( { text, children } ) {
const ref = useCopyToClipboard( text );
return (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
variant="secondary"
ref={ ref }
>
<Button size="compact" variant="secondary" ref={ ref }>
{ children }
</Button>
);
Expand Down
4 changes: 1 addition & 3 deletions packages/customize-widgets/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ function Inserter( { setIsOpened } ) {
{ __( 'Add a block' ) }
</h2>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
className="customize-widgets-layout__inserter-panel-header-close-button"
size="small"
icon={ closeSmall }
onClick={ () => setIsOpened( false ) }
aria-label={ __( 'Close inserter' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export default function WelcomeGuide( { sidebar } ) {
) }
</p>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
className="customize-widgets-welcome-guide__button"
size="compact"
variant="primary"
onClick={ () =>
toggle( 'core/customize-widgets', 'welcomeGuide' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
return (
<motion.div whileHover="expand">
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
className={ classes }
href={ buttonHref }
label={ buttonLabel }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`FullscreenModeClose when in full screen mode should display a default s
<div>
<a
aria-label="Back"
class="components-button edit-post-fullscreen-mode-close"
class="components-button edit-post-fullscreen-mode-close is-next-40px-default-size"
href="edit.php?"
>
<svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ export default function InitPatternModal() {
/>
<HStack justify="right">
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
variant="primary"
type="submit"
disabled={ ! title }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export function CustomFieldsConfirmation( { willEnable } ) {
) }
</p>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
className="edit-post-preferences-modal__custom-fields-confirmation-button"
__next40pxDefaultSize
variant="secondary"
isBusy={ isReloading }
accessibleWhenDisabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
A page reload is required for this change. Make sure your content is saved before reloading.
</p>
<button
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
class="components-button is-next-40px-default-size is-secondary"
type="button"
>
Show & Reload Page
Expand Down Expand Up @@ -300,7 +300,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
A page reload is required for this change. Make sure your content is saved before reloading.
</p>
<button
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
class="components-button is-next-40px-default-size is-secondary"
type="button"
>
Hide & Reload Page
Expand Down

0 comments on commit bed3a43

Please sign in to comment.