Skip to content

Commit

Permalink
Apply Lena's suggestion to change 'div' to 'button'
Browse files Browse the repository at this point in the history
Also, correct some typing errors.
  • Loading branch information
kienstra committed Jan 22, 2023
1 parent 309db5c commit 31cbdab
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useBorderBoxControlLinkedButton } from './hook';
import type { LinkedButtonProps } from '../types';

const BorderBoxControlLinkedButton = (
props: WordPressComponentProps< LinkedButtonProps, 'div' >,
props: WordPressComponentProps< LinkedButtonProps, 'button' >,
forwardedRef: React.ForwardedRef< any >
) => {
const { className, isLinked, ...buttonProps } =
Expand All @@ -27,7 +27,7 @@ const BorderBoxControlLinkedButton = (
<Tooltip text={ label }>
<View className={ className }>
<Button
{ ...( buttonProps as Parameters< typeof Button >[ 0 ] ) }
{ ...buttonProps }
isSmall
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useCx } from '../../utils/hooks/use-cx';
import type { LinkedButtonProps } from '../types';

export function useBorderBoxControlLinkedButton(
props: WordPressComponentProps< LinkedButtonProps, 'div' >
props: WordPressComponentProps< LinkedButtonProps, 'button' >
) {
const {
className,
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/button/deprecated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import Button from '.';
import type { ButtonProps, DeprecatedIconButtonProps, TagName } from './types';
import type { WordPressComponentProps } from '../ui/context';
import type { DeprecatedIconButtonProps } from './types';

function UnforwardedIconButton(
{
Expand Down
12 changes: 2 additions & 10 deletions packages/components/src/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@ import Tooltip from '../tooltip';
import Icon from '../icon';
import { VisuallyHidden } from '../visually-hidden';
import type { WordPressComponentProps } from '../ui/context';
import type {
ButtonProps,
DeprecatedButtonProps,
DisabledEvent,
TagName,
} from './types';
import type { ButtonProps, DeprecatedButtonProps, TagName } from './types';

const disabledEventsOnDisabledButton = [
'onMouseDown',
'onClick',
] as const;
const disabledEventsOnDisabledButton = [ 'onMouseDown', 'onClick' ] as const;

function useDeprecatedProps( {
isDefault,
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { ReactNode } from 'react';
* Internal dependencies
*/
import type { Props as IconProps } from '../icon';
import type { PopoverProps } from '../popover/types';

export type ButtonProps = {
/**
Expand Down

0 comments on commit 31cbdab

Please sign in to comment.