Skip to content

Commit

Permalink
fix: remove unexpected clicking outlines (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n authored Jun 7, 2022
1 parent 76da2e2 commit ead53c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 130 deletions.
2 changes: 0 additions & 2 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
"@headlessui/react": "1.6.4",
"@next/bundle-analyzer": "12.1.5",
"@radix-ui/colors": "0.1.8",
"@react-aria/button": "3.5.0",
"@react-types/button": "3.5.0",
"@sendinblue/client": "3.1.0",
"@storybook/jest": "0.0.10",
"@storybook/testing-library": "0.0.11",
Expand Down
21 changes: 4 additions & 17 deletions apps/main/src/components/button/base-button.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { useButton } from '@react-aria/button';
import { AriaButtonProps } from '@react-types/button';
import clsx from 'clsx';
import * as React from 'react';

export type BaseButtonProps = AriaButtonProps &
Omit<React.ComponentPropsWithRef<'button'>, keyof AriaButtonProps>;
export type BaseButtonProps = React.ComponentPropsWithRef<'button'>;

const BaseButton = React.forwardRef(function BaseButton(
export const BaseButton = React.forwardRef(function BaseButton(
{ type = 'button', children, className, onClick, onMouseDown, ...restProps }: BaseButtonProps,
ref: React.Ref<HTMLButtonElement>,
): JSX.Element {
Expand All @@ -18,16 +15,8 @@ const BaseButton = React.forwardRef(function BaseButton(
},
[onMouseDown],
);
const defaultRef = React.useRef<HTMLButtonElement>();
const _ref: React.RefObject<HTMLButtonElement> = (ref ||
defaultRef) as React.RefObject<HTMLButtonElement>;
const props = {
type,
...restProps,
};
const { buttonProps } = useButton(props, _ref);
const allProps = {
...buttonProps,
type,
...restProps,
};

Expand All @@ -40,11 +29,9 @@ const BaseButton = React.forwardRef(function BaseButton(
)}
onMouseDown={handleMouseDown}
onClick={onClick}
ref={_ref}
ref={ref}
>
{children}
</button>
);
});

export { BaseButton };
111 changes: 0 additions & 111 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ead53c5

Please sign in to comment.