Skip to content

Commit

Permalink
[173] Remove usage of Banner in FormContainer
Browse files Browse the repository at this point in the history
Also set Banner as deprecated

Bug: #173
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
  • Loading branch information
lfasani committed Dec 16, 2020
1 parent abda0d1 commit 09e153f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
3 changes: 3 additions & 0 deletions frontend/src/core/banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*
* Contributors:
* Obeo - initial API and implementation
*
* @deprecated use @material-ui/core/Snackbar instead
*
*******************************************************************************/
import { Text } from 'core/text/Text';
import { Danger } from 'icons';
Expand Down
9 changes: 1 addition & 8 deletions frontend/src/views/FormContainer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@
.container {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: min-content 80px min-content;
}

.bannerArea {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr;
align-items: center;
grid-template-rows: min-content min-content;
}

.content {
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/views/FormContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
import { Banner } from 'core/banner/Banner';
import { Text } from 'core/text/Text';
import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -19,19 +18,16 @@ import styles from './FormContainer.module.css';
const propTypes = {
title: PropTypes.string.isRequired,
subtitle: PropTypes.string.isRequired,
banner: PropTypes.node,
children: PropTypes.node.isRequired,
};

export const FormContainer = ({ title, subtitle, banner, children }) => {
let bannerContent = banner ? <Banner data-testid="banner" content={banner} /> : null;
export const FormContainer = ({ title, subtitle, children }) => {
return (
<div className={styles.container}>
<div className={styles.titleContainer}>
<Text className={styles.title}>{title}</Text>
<Text className={styles.subtitle}>{subtitle}</Text>
</div>
<div className={styles.bannerArea}>{bannerContent}</div>
<div className={styles.content}>{children}</div>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/new-project/NewProjectView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { FormContainer } from 'views/FormContainer';
import { View } from 'views/View';
import {
HANDLE_CHANGE_NAME__ACTION,
HANDLE_SUBMIT__ACTION,
HANDLE_SUBMIT_FAILURE__ACTION,
HANDLE_SUBMIT__ACTION,
VALID__STATE,
} from './machine';
import styles from './NewProjectView.module.css';
Expand Down Expand Up @@ -62,7 +62,7 @@ export const NewProjectView = () => {
const [createProject, { loading, data, error }] = useMutation(createProjectMutation);
const [state, dispatch] = useReducer(reducer, initialState);

const { viewState, name, nameMessage, nameMessageSeverity, message, newProjectId } = state;
const { viewState, name, nameMessage, nameMessageSeverity, newProjectId } = state;

const onNameChange = (event) => {
const name = event.target.value;
Expand Down Expand Up @@ -101,7 +101,7 @@ export const NewProjectView = () => {
) : null;
return (
<View condensed>
<FormContainer title="Create a new project" subtitle="Get started by creating a new project" banner={message}>
<FormContainer title="Create a new project" subtitle="Get started by creating a new project">
<Form onSubmit={onCreateNewProject}>
<Label value="Name">
<Textfield
Expand Down

0 comments on commit 09e153f

Please sign in to comment.