Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui v2: use new alert for note panel and fix layout max width #864

Merged
merged 1 commit into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/packages/core/src/Feedback/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const StyledAlert = styled(MuiAlert)(
paddingBottom: "20px",
color: "rgba(13, 16, 48, 0.6)",
fontSize: "14px",
overflow: "auto",
".MuiAlert-icon": {
marginRight: "16px",
padding: "0",
},
".MuiAlert-message": {
maxWidth: "calc(100% - 40px)",
width: "100%",
padding: "0",
".MuiAlertTitle-root": {
Expand Down
13 changes: 8 additions & 5 deletions frontend/packages/core/src/Feedback/note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import React from "react";
import styled from "@emotion/styled";
import { Grid, Paper } from "@material-ui/core";
import type { Color } from "@material-ui/lab/Alert";
import MuiAlert from "@material-ui/lab/Alert";

const Alert = styled(MuiAlert)({
alignItems: "center",
import { Alert } from "./alert"

const NotePanelContainer = styled(Grid)({
"> *": {
padding: "4px 0",
}
});

export interface NoteProps {
Expand Down Expand Up @@ -34,14 +37,14 @@ const Note: React.FC<NoteProps> = ({ severity = "info", children }) => {
};

const NotePanel: React.FC<NotePanelProps> = ({ direction = "column", notes, children }) => (
<Grid container direction={direction} justify="center" alignContent="space-between" wrap="nowrap">
<NotePanelContainer container direction={direction} justify="center" alignContent="space-between" wrap="nowrap">
{notes?.map((note: NoteConfig) => (
<Note key={note.text} severity={note.severity}>
{note.text}
</Note>
))}
{children}
</Grid>
</NotePanelContainer>
);

export { Note, NotePanel };