diff --git a/db.json b/db.json index f2ae48d..0e0dcd2 100644 --- a/db.json +++ b/db.json @@ -1,19 +1,3 @@ { - "posts": [ - { - "id": 1, - "title": "json-server", - "author": "typicode" - } - ], - "comments": [ - { - "id": 1, - "body": "some comment", - "postId": 1 - } - ], - "profile": { - "name": "typicode" - } + } \ No newline at end of file diff --git a/plop-templates/component.scss b/plop-templates/component.scss index 2bedf49..b6a03ed 100644 --- a/plop-templates/component.scss +++ b/plop-templates/component.scss @@ -1,3 +1,5 @@ +@import "../../index.scss"; + .{{ dashCase name }} { } diff --git a/src/assets/img/beer.jpeg b/src/assets/img/beer.jpeg new file mode 100644 index 0000000..56c0da5 Binary files /dev/null and b/src/assets/img/beer.jpeg differ diff --git a/src/assets/scss/normalize.css b/src/assets/scss/normalize.css new file mode 100644 index 0000000..3d6624c --- /dev/null +++ b/src/assets/scss/normalize.css @@ -0,0 +1,341 @@ +/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} \ No newline at end of file diff --git a/src/components/Card/Card.scss b/src/components/Card/Card.scss new file mode 100644 index 0000000..ae1b620 --- /dev/null +++ b/src/components/Card/Card.scss @@ -0,0 +1,27 @@ +@import "../../index.scss"; + +.card { + background-color: $white; + width: 20rem; + white-space: wrap; + text-align: left; + margin: 1rem 1rem; + + &__title { + font-weight: bold; + font-size: 1.4rem; + padding: 1rem; + display: flex; + } + + &__image { + width: 100%; + margin-bottom: 1rem; + } + + &__text { + font-size: 0.8rem; + font-weight: lighter; + padding: 1rem; + } +} diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx new file mode 100644 index 0000000..ecb311e --- /dev/null +++ b/src/components/Card/Card.tsx @@ -0,0 +1,25 @@ +import * as React from "react"; +import { Link } from "react-router-dom"; +import "./Card.scss"; + +export interface CardProps { + title: string; + text: string; + image: string; +} +export interface CardState {} + +class Card extends React.Component { + render() { + const { title, text, image } = this.props; + return ( + +
{title}
+ +
{text}
+ + ); + } +} + +export default Card; diff --git a/src/components/Card/index.ts b/src/components/Card/index.ts new file mode 100644 index 0000000..af0084f --- /dev/null +++ b/src/components/Card/index.ts @@ -0,0 +1,2 @@ +import Card from "./Card"; +export default Card; diff --git a/src/components/Footer/Footer.scss b/src/components/Footer/Footer.scss new file mode 100644 index 0000000..84047fe --- /dev/null +++ b/src/components/Footer/Footer.scss @@ -0,0 +1,15 @@ +@import "../../index.scss"; + +.footer { + width: 100%; + padding: 0.5rem; + margin-top: 10rem; + + &__content { + position: absolute; + bottom: 0; + padding: 1rem; + width: 100%; + text-align: center; + } +} diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx new file mode 100644 index 0000000..862a53f --- /dev/null +++ b/src/components/Footer/Footer.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import "./Footer.scss"; + +export interface FooterProps {} +export interface FooterState {} + +class Footer extends React.Component { + render() { + return +
+
+
+ Aalto-yliopiston Sähköinsinöörikilta © 2018 +
+
; + } +} + +export default Footer; diff --git a/src/components/Footer/index.ts b/src/components/Footer/index.ts new file mode 100644 index 0000000..ccb5e78 --- /dev/null +++ b/src/components/Footer/index.ts @@ -0,0 +1,2 @@ +import Footer from "./Footer"; +export default Footer; diff --git a/src/components/Header/Header.scss b/src/components/Header/Header.scss new file mode 100644 index 0000000..df1da96 --- /dev/null +++ b/src/components/Header/Header.scss @@ -0,0 +1,5 @@ +.header { + display: flex; + flex-flow: column nowrap; + align-items: center; +} diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx new file mode 100644 index 0000000..deb569d --- /dev/null +++ b/src/components/Header/Header.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import "./Header.scss"; +import Navigation from "../Navigation"; + +export interface HeaderProps {} +export interface HeaderState {} + +class Header extends React.Component { + render() { + return ( +
+

Aalto-yliopiston Sähköinsinöörikilta

+ +
+ ); + } +} + +export default Header; diff --git a/src/components/Header/index.ts b/src/components/Header/index.ts new file mode 100644 index 0000000..aa3e4e8 --- /dev/null +++ b/src/components/Header/index.ts @@ -0,0 +1,2 @@ +import Header from "./Header"; +export default Header; diff --git a/src/components/Navigation/Navigation.scss b/src/components/Navigation/Navigation.scss new file mode 100644 index 0000000..f55be75 --- /dev/null +++ b/src/components/Navigation/Navigation.scss @@ -0,0 +1,22 @@ +@import "../../index.scss"; +$border-width: 4px; + +.navigation { + width: 100%; + display: flex; + flex-flow: row nowrap; + justify-content: center; + margin-bottom: 3rem; + + &__item { + background-color: $off-white; + padding: 0.8rem 2rem; + transition: background-color 0.2s; + border-bottom: $border-width solid $blue; + cursor: pointer; + + &:hover { + background-color: $light-blue; + } + } +} diff --git a/src/components/Navigation/Navigation.tsx b/src/components/Navigation/Navigation.tsx new file mode 100644 index 0000000..728628b --- /dev/null +++ b/src/components/Navigation/Navigation.tsx @@ -0,0 +1,22 @@ +import * as React from "react"; +import "./Navigation.scss"; +import { Link } from "react-router-dom"; + +export interface NavigationProps {} +export interface NavigationState {} + +class Navigation extends React.Component { + render() { + return ( +
+ Etusivu + Kilta + International + Opinnot + Yrityksille +
+ ); + } +} + +export default Navigation; diff --git a/src/components/Navigation/index.ts b/src/components/Navigation/index.ts new file mode 100644 index 0000000..9315d7d --- /dev/null +++ b/src/components/Navigation/index.ts @@ -0,0 +1,2 @@ +import Navigation from "./Navigation"; +export default Navigation; diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..999d0e9 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,3 @@ +declare module "*.jpeg" { export default '' as string; }; +declare module '*.css' { export default '' as string; }; +declare module '*.png' { export default '' as string; }; \ No newline at end of file diff --git a/src/index.scss b/src/index.scss index 90889ba..48a44be 100644 --- a/src/index.scss +++ b/src/index.scss @@ -1,4 +1,8 @@ -$white: #f4f7fc; +@import "{}/src/assets/scss/normalize.css"; + +$white: #fff; +$off-white: #f4f7fc; +$light-blue: #e4ecfa; $blue: #2f6c76; $dark-blue: #193b41; @@ -7,11 +11,17 @@ $font-helvetica: helvetica, arial, sans-serif; html, body { font-size: 16px; - margin-top: 2rem; - background-color: $white; + background-color: $off-white; height: 100%; font-family: $font-helvetica; color: $blue; + text-align: center; + overflow: auto; +} + +#root { + position: relative; + min-height: 100vh; } body { @@ -28,3 +38,9 @@ p { color: $dark-blue; font-size: 1.5rem; } + +a, +a:hover { + text-decoration: none; + color: $blue; +} diff --git a/src/index.tsx b/src/index.tsx index 6099631..e24297c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -5,6 +5,7 @@ import {AppContainer} from "react-hot-loader"; import Routes from "./routes"; import "normalize.css"; import "./index.scss"; +import "./index.d.ts"; const rootEl = document.getElementById("root"); diff --git a/src/pages/CommonPage/CommonPage.tsx b/src/pages/CommonPage/CommonPage.tsx new file mode 100644 index 0000000..8f1eb42 --- /dev/null +++ b/src/pages/CommonPage/CommonPage.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; +import Header from "../../components/Header"; +import Footer from "../../components/Footer"; + +export interface CommonPageProps { + page: any; +} +export interface CommonPageState {} + +class CommonPage extends React.Component { + render() { + const Page = this.props.page; + return ( + +
+ +