Skip to content

Commit

Permalink
Added features
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaSenchenko committed Sep 21, 2018
1 parent a26be4c commit d162796
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 170 deletions.
11 changes: 1 addition & 10 deletions homeworks/homework-1/app/src/App.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
.App-logo {
height: 200px;
}

.App-header {
background-color: rgb(108, 182, 39);
height: 260px;
padding: 10px;
color: white;
}




Expand Down
12 changes: 6 additions & 6 deletions homeworks/homework-1/app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
Route,
BrowserRouter
} from "react-router-dom";
import {Login} from "./components/Login";
import {Course} from "./components/Course";
import {CourseList} from "./components/CourseList";
import {LoginPage} from "./features/LoginPage";
import {CourseEditPage} from "./features/CourseEditPage";
import {CourseListPage} from "./features/CourseListPage";
import './App.css';

class App extends React.Component {
Expand All @@ -15,9 +15,9 @@ class App extends React.Component {
<div className="App">
<BrowserRouter>
<div className="content">
<Route exact path="/" component={Login}/>
<Route exact path="/course" component={Course}/>
<Route exact path="/courses" component={CourseList}/>
<Route exact path="/" component={LoginPage}/>
<Route exact path="/course" component={CourseEditPage}/>
<Route exact path="/courses" component={CourseListPage}/>
</div>
</BrowserRouter>
</div>
Expand Down
74 changes: 0 additions & 74 deletions homeworks/homework-1/app/src/components/Course.jsx

This file was deleted.

3 changes: 3 additions & 0 deletions homeworks/homework-1/app/src/components/CourseForm.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.button--cancel {
margin-left: 10px;
}
64 changes: 64 additions & 0 deletions homeworks/homework-1/app/src/components/CourseForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from "react";
import {
Button,
Col,
ControlLabel,
Form,
FormControl,
FormGroup
} from "react-bootstrap";
import './CourseForm.css';

class CourseForm extends React.Component {

render() {
return (
<Form horizontal>
<FormGroup controlId="title">
<Col componentClass={ControlLabel} sm={4}>
Title
</Col>
<Col sm={2}>
<FormControl type="text" placeholder="Title"/>
</Col>
</FormGroup>

<FormGroup controlId="Description">
<Col componentClass={ControlLabel} sm={4}>
Description
</Col>
<Col sm={2}>
<FormControl componentClass="textarea" placeholder="Text area"/>
</Col>
</FormGroup>

<FormGroup controlId="date">
<Col componentClass={ControlLabel} sm={4}>
Date
</Col>
<Col sm={2}>
<FormControl type="text" placeholder="Date"/>
</Col>
</FormGroup>

<FormGroup controlId="duration">
<Col componentClass={ControlLabel} sm={4}>
Duration
</Col>
<Col sm={1}>
<FormControl type="number" min="0" placeholder="Min"/>
</Col>
</FormGroup>

<FormGroup>
<Col smOffset={4} sm={4}>
<Button type="submit">Save</Button>
<Button className="button--cancel" type="submit">Cancel</Button>
</Col>
</FormGroup>
</Form>
);
}
}

export {CourseForm};
4 changes: 2 additions & 2 deletions homeworks/homework-1/app/src/components/CourseListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CourseListItem extends React.Component {
render() {
return (
<Grid>
<Col sm={10}>
<Col sm={8}>
<Row>
<Col sm={4}>
<b>{this.props.title}</b>
Expand Down Expand Up @@ -40,7 +40,7 @@ class CourseListItem extends React.Component {
CourseListItem.propTypes = {
title: PropTypes.string,
duration: PropTypes.number,
date: PropTypes.string,
date: PropTypes.instanceOf(Date),
description: PropTypes.string
};

Expand Down
65 changes: 0 additions & 65 deletions homeworks/homework-1/app/src/components/Login.jsx

This file was deleted.

58 changes: 58 additions & 0 deletions homeworks/homework-1/app/src/components/LoginForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import {
Button,
Form,
FormGroup,
FormControl,
ControlLabel,
Col
} from "react-bootstrap";

class LoginForm extends React.Component {

constructor(props) {
super(props);
this.state = {
hintEmail: "*enter your email",
hintPassword: "*enter your password"
}
}

render() {
return (
<Form horizontal>
<FormGroup controlId="email">
<Col componentClass={ControlLabel} sm={4}>
Email
</Col>
<Col sm={2}>
<FormControl type="email" placeholder="Email"/>
</Col>
<Col componentClass={ControlLabel}>
{this.state.hintEmail}
</Col>
</FormGroup>

<FormGroup controlId="password">
<Col componentClass={ControlLabel} sm={4}>
Password
</Col>
<Col sm={2}>
<FormControl type="password" placeholder="Password"/>
</Col>
<Col componentClass={ControlLabel}>
{this.state.hintPassword}
</Col>
</FormGroup>

<FormGroup>
<Col smOffset={4} sm={4}>
<Button type="submit">Sign in</Button>
</Col>
</FormGroup>
</Form>
);
}
}

export {LoginForm};
11 changes: 11 additions & 0 deletions homeworks/homework-1/app/src/components/common/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.header {
background-color: rgb(108, 182, 39);
height: 260px;
padding: 10px;
color: white;
}

.header__logo {
height: 200px;
margin-right: 20px;
}
5 changes: 3 additions & 2 deletions homeworks/homework-1/app/src/components/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {
} from "react-bootstrap";
import PropTypes from 'prop-types';
import logo from "../../logo.jpg";
import './Header.css';

class Header extends React.Component {

render() {
return (
<PageHeader className="App-header">
<Image src={logo} className="App-logo"/>{' '}{this.props.pageTitle}
<PageHeader className="header">
<Image src={logo} className="header__logo"/>{this.props.pageTitle}
</PageHeader>
);
}
Expand Down
24 changes: 24 additions & 0 deletions homeworks/homework-1/app/src/features/CourseEditPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
import {Header} from "../components/common/Header"
import {CourseForm} from "../components/CourseForm";

class CourseEditPage extends React.Component {

constructor(props) {
super(props);
this.state = {
title: "Edit course"
}
}

render() {
return (
<div>
<Header pageTitle={this.state.title}/>
<CourseForm/>
</div>
);
}
}

export {CourseEditPage};
4 changes: 4 additions & 0 deletions homeworks/homework-1/app/src/features/CourseListPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.form-group {
margin-left: 20px;
margin-right: 20px;
}
Loading

0 comments on commit d162796

Please sign in to comment.