mirror of
https://github.com/wassname/talk.git
synced 2026-07-26 13:37:38 +08:00
Working type submit for forms - Button Component
This commit is contained in:
@@ -32,6 +32,8 @@ interface InnerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
|
||||
/** Internal: Forwarded Ref */
|
||||
forwardRef?: Ref<HTMLButtonElement>;
|
||||
|
||||
type?: "submit" | "reset" | "button";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,15 +47,17 @@ const BaseButton: StatelessComponent<InnerProps> = ({
|
||||
keyboardFocus,
|
||||
mouseHover,
|
||||
forwardRef,
|
||||
type: typeProp,
|
||||
type,
|
||||
...rest
|
||||
}) => {
|
||||
console.log("type", type, "Basebutton");
|
||||
|
||||
let Element = "button";
|
||||
|
||||
if (anchor) {
|
||||
Element = "a";
|
||||
}
|
||||
|
||||
let type = typeProp;
|
||||
if (anchor && type) {
|
||||
// tslint:disable:next-line: no-console
|
||||
console.warn(
|
||||
@@ -69,7 +73,9 @@ const BaseButton: StatelessComponent<InnerProps> = ({
|
||||
[classes.mouseHover]: mouseHover,
|
||||
});
|
||||
|
||||
return <Element {...rest} className={rootClassName} ref={forwardRef} />;
|
||||
return (
|
||||
<Element {...rest} className={rootClassName} ref={forwardRef} type={type} />
|
||||
);
|
||||
};
|
||||
|
||||
const enhanced = withForwardRef(
|
||||
|
||||
Reference in New Issue
Block a user