Skip to content

Commit

Permalink
Bugfix/oauth visual issues (#730)
Browse files Browse the repository at this point in the history
* Use button for MessagePanel action

* Use MessagePanel with Loader for AppSettings loading state
  • Loading branch information
adrianmroz-allegro committed Apr 16, 2021
1 parent 8856299 commit ef053d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as React from "react";
import { AppSettings } from "../../../common/models/app-settings/app-settings";
import { Unary } from "../../../common/utils/functional/functional";
import { Loader } from "../../components/loader/loader";
import { MessagePanel } from "../../components/message-panel/message-panel";
import { Ajax } from "../../utils/ajax/ajax";

enum SettingsResourceStatus { LOADED, LOADING, ERROR }
Expand Down Expand Up @@ -83,7 +84,9 @@ export class AppSettingsProvider extends React.Component<AppSettingsProviderProp
const { appSettings } = this.state;
switch (appSettings.status) {
case SettingsResourceStatus.LOADING:
return <Loader/>;
return <MessagePanel title="Loading data sources...">
<Loader/>
</MessagePanel>;
case SettingsResourceStatus.ERROR:
throw appSettings.error;
case SettingsResourceStatus.LOADED:
Expand Down
14 changes: 4 additions & 10 deletions src/client/components/message-panel/message-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,8 @@
font-size: 14px;
}

.message-panel__action {
@include css-variable(color, brand);
margin-top: 24px;
font-size: 18px;
cursor: pointer;
text-align: center;

&:hover {
text-decoration: underline;
}
.message-panel__children {
margin-top: 36px;
display: flex;
justify-content: center;
}
7 changes: 5 additions & 2 deletions src/client/components/message-panel/message-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import * as React from "react";
import { Nullary } from "../../../common/utils/functional/functional";
import { Button } from "../button/button";
import "./message-panel.scss";

interface ErrorViewActionProps {
Expand All @@ -24,7 +25,7 @@ interface ErrorViewActionProps {
}

export const MessagePanelAction: React.SFC<ErrorViewActionProps> = ({ action, label }) =>
<div className="message-panel__action" onClick={action}>{label}</div>;
<Button type="primary" onClick={action} title={label} />;

interface ErrorViewProps {
message?: string;
Expand All @@ -36,7 +37,9 @@ export const MessagePanel: React.SFC<ErrorViewProps> = ({ message, title, childr
<div className="message-panel__container">
<div className="message-panel__title">{title}</div>
{message && <div className="message-panel__message">{message}</div>}
{children}
{React.Children.count(children) > 0 && <div className="message-panel__children">
{children}
</div>}
</div>
</div>;
};

0 comments on commit ef053d2

Please sign in to comment.