Skip to content

Commit

Permalink
Remove useless clsx calls. (WordPress#61969)
Browse files Browse the repository at this point in the history
* Remove useless clsx calls.

* Review fixes.

Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org>
Co-authored-by: fullofcaffeine <fullofcaffeine@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
  • Loading branch information
5 people authored and carstingaxion committed Jun 4, 2024
1 parent bccf48e commit cbe6247
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
3 changes: 1 addition & 2 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const SiteLogo = ( {
const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
const [ isEditingImage, setIsEditingImage ] = useState( false );
const { toggleSelection } = useDispatch( blockEditorStore );
const classes = clsx( 'custom-logo-link' );
const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
const settings = select( blockEditorStore ).getSettings();
const siteEntities = select( coreStore ).getEntityRecord(
Expand Down Expand Up @@ -136,7 +135,7 @@ const SiteLogo = ( {
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
<a
href={ siteUrl }
className={ classes }
className="custom-logo-link"
rel="home"
title={ title }
onClick={ ( event ) => event.preventDefault() }
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/animate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getDefaultOrigin( type?: GetAnimateOptions[ 'type' ] ) {
*/
export function getAnimateClassName( options: GetAnimateOptions ) {
if ( options.type === 'loading' ) {
return clsx( 'components-animate__loading' );
return 'components-animate__loading';
}

const { type, origin = getDefaultOrigin( type ) } = options;
Expand Down
11 changes: 7 additions & 4 deletions packages/components/src/focal-point-picker/focal-point.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PointerCircle } from './styles/focal-point-style';
/**
* External dependencies
*/
import clsx from 'clsx';
import type { FocalPointProps } from './types';
import type { WordPressComponentProps } from '../context';

Expand All @@ -15,9 +14,13 @@ export default function FocalPoint( {
top = '50%',
...props
}: WordPressComponentProps< FocalPointProps, 'div' > ) {
const classes = clsx( 'components-focal-point-picker__icon_container' );

const style = { left, top };

return <PointerCircle { ...props } className={ classes } style={ style } />;
return (
<PointerCircle
{ ...props }
className="components-focal-point-picker__icon_container"
style={ style }
/>
);
}
4 changes: 1 addition & 3 deletions packages/edit-site/src/components/save-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ export default function SavePanel() {
>
<Button
variant="secondary"
className={ clsx(
'edit-site-editor__toggle-save-panel-button'
) }
className="edit-site-editor__toggle-save-panel-button"
onClick={ () => setIsSaveViewOpened( true ) }
aria-haspopup={ 'dialog' }
disabled={ disabled }
Expand Down
10 changes: 5 additions & 5 deletions storybook/decorators/with-global-css.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import clsx from 'clsx';

/**
* WordPress dependencies
*/
Expand All @@ -14,6 +9,11 @@ import { useEffect } from '@wordpress/element';
import basicStyles from '../global-basic.lazy.scss';
import wordPressStyles from '../global-wordpress.lazy.scss';

/**
* External dependencies
*/
import clsx from 'clsx';

/**
* A Storybook decorator to inject global CSS.
*
Expand Down

0 comments on commit cbe6247

Please sign in to comment.