Merge with 2.0.0-m3

This commit is contained in:
Rene Pfeuffer
2019-11-18 13:15:54 +01:00
7 changed files with 42 additions and 12 deletions

View File

@@ -80,7 +80,7 @@ class ApiClient {
return fetch(createUrl(url), applyFetchOptions({})).then(handleFailure);
}
post(url: string, payload: any, contentType = "application/json") {
post(url: string, payload?: any, contentType = "application/json") {
return this.httpRequestWithJSONBody("POST", url, contentType, payload);
}
@@ -115,11 +115,13 @@ class ApiClient {
return fetch(createUrl(url), options).then(handleFailure);
}
httpRequestWithJSONBody(method: string, url: string, contentType: string, payload: any): Promise<Response> {
httpRequestWithJSONBody(method: string, url: string, contentType: string, payload?: any): Promise<Response> {
const options: RequestInit = {
method: method,
body: JSON.stringify(payload)
method: method
};
if (payload) {
options.body = JSON.stringify(payload);
}
return this.httpRequestWithBinaryBody(options, url, contentType);
}

View File

@@ -18,6 +18,7 @@ export type ButtonProps = {
type Props = ButtonProps &
RouteComponentProps & {
title?: string;
type?: "button" | "submit" | "reset";
color?: string;
};
@@ -38,7 +39,19 @@ class Button extends React.Component<Props> {
};
render() {
const { label, loading, disabled, type, color, className, icon, fullWidth, reducedMobile, children } = this.props;
const {
label,
title,
loading,
disabled,
type,
color,
className,
icon,
fullWidth,
reducedMobile,
children
} = this.props;
const loadingClass = loading ? "is-loading" : "";
const fullWidthClass = fullWidth ? "is-fullwidth" : "";
const reducedMobileClass = reducedMobile ? "is-reduced-mobile" : "";
@@ -46,6 +59,7 @@ class Button extends React.Component<Props> {
return (
<button
type={type}
title={title}
disabled={disabled}
onClick={this.onClick}
className={classNames("button", "is-" + color, loadingClass, fullWidthClass, reducedMobileClass, className)}
@@ -63,6 +77,7 @@ class Button extends React.Component<Props> {
return (
<button
type={type}
title={title}
disabled={disabled}
onClick={this.onClick}
className={classNames("button", "is-" + color, loadingClass, fullWidthClass, className)}

View File

@@ -48,7 +48,6 @@ const buttonStory = (name: string, storyFn: () => ReactElement) => {
.addDecorator(SpacingDecorator)
.add("Default", storyFn);
};
buttonStory("AddButton", () => <AddButton>Add</AddButton>);
buttonStory("CreateButton", () => <CreateButton>Create</CreateButton>);
buttonStory("DeleteButton", () => <DeleteButton>Delete</DeleteButton>);