fix(striker-ui): enable atom Button to accept HTML button props

main
Tsu-ba-me 4 years ago
parent a08c2b24ad
commit 14d3627c90
  1. 3
      striker-ui/components/atoms/Button.tsx
  2. 3
      striker-ui/types/ButtonProps.d.ts

@ -63,6 +63,7 @@ const Button: FunctionComponent<ButtonProps> = ({
isSubmit, isSubmit,
labelProps, labelProps,
linkProps, linkProps,
onClick,
}) => { }) => {
const imageElement: JSX.Element | undefined = getButtonImageElement( const imageElement: JSX.Element | undefined = getButtonImageElement(
imageProps, imageProps,
@ -91,7 +92,7 @@ const Button: FunctionComponent<ButtonProps> = ({
); );
} else { } else {
resultElement = ( resultElement = (
<StyledButton type={isSubmit ? 'submit' : 'button'}> <StyledButton type={isSubmit ? 'submit' : 'button'} {...{ onClick }}>
{imageElement} {imageElement}
{separatorElement} {separatorElement}
{labelElement} {labelElement}

@ -1,3 +1,4 @@
import { ButtonHTMLAttributes } from 'react';
import { LinkProps } from 'next/link'; import { LinkProps } from 'next/link';
import { ButtonImageProps } from './ButtonImageProps'; import { ButtonImageProps } from './ButtonImageProps';
@ -7,4 +8,4 @@ type ButtonProps = {
isSubmit?: boolean; isSubmit?: boolean;
labelProps?: LabelProps; labelProps?: LabelProps;
linkProps?: LinkProps; linkProps?: LinkProps;
}; } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'>;

Loading…
Cancel
Save