diff --git a/src/css/DefaultPage.css b/src/elements/PageTitle/PageTitle.css
similarity index 99%
rename from src/css/DefaultPage.css
rename to src/elements/PageTitle/PageTitle.css
index 5f6d3da..1739eab 100644
--- a/src/css/DefaultPage.css
+++ b/src/elements/PageTitle/PageTitle.css
@@ -15,4 +15,3 @@
font-size: 23pt;
opacity: 0.6;
}
-
diff --git a/src/elements/PageTitle/PageTitle.js b/src/elements/PageTitle/PageTitle.js
new file mode 100644
index 0000000..b7ef224
--- /dev/null
+++ b/src/elements/PageTitle/PageTitle.js
@@ -0,0 +1,26 @@
+import React from "react";
+import "./PageTitle.css"
+
+class PageTitle extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.props = props;
+
+ }
+
+ render() {
+ return (
+
+ {this.props.title}
+ {this.props.subtitle}
+ <>
+ {this.props.children}
+ >
+
+
+ );
+ }
+}
+
+export default PageTitle;
\ No newline at end of file
diff --git a/src/elements/PageTitle/PageTitle.test.js b/src/elements/PageTitle/PageTitle.test.js
new file mode 100644
index 0000000..47b0a80
--- /dev/null
+++ b/src/elements/PageTitle/PageTitle.test.js
@@ -0,0 +1,31 @@
+import React from 'react';
+import {shallow} from 'enzyme'
+
+import PageTitle from "./PageTitle";
+
+describe('', function () {
+ it('renders without crashing ', function () {
+ const wrapper = shallow();
+ wrapper.unmount();
+ });
+
+ it('renders childs correctly', function () {
+ const wrapper = shallow(heyimachild);
+
+ const children = wrapper.children();
+ expect(children.at(children.length-2).text()).toBe("heyimachild");
+ });
+
+ it('renders pagetitle prop', function () {
+ const wrapper = shallow();
+
+ expect(wrapper.find(".pageheader").text()).toBe("testtitle");
+ });
+
+ it('renders subtitle prop', function () {
+ const wrapper = shallow();
+
+ expect(wrapper.find(".pageheadersubtitle").text()).toBe("testsubtitle");
+ });
+});
+
diff --git a/src/pages/CategoryPage/CategoryPage.js b/src/pages/CategoryPage/CategoryPage.js
index 3cfc451..c584295 100644
--- a/src/pages/CategoryPage/CategoryPage.js
+++ b/src/pages/CategoryPage/CategoryPage.js
@@ -4,6 +4,7 @@ import Tag from "../../elements/Tag/Tag";
import {TagPreview} from "../../elements/Preview/Preview";
import NewTagPopup from "../../elements/NewTagPopup/NewTagPopup";
+import PageTitle from "../../elements/PageTitle/PageTitle";
class CategoryPage extends React.Component {
constructor(props, context) {
@@ -24,12 +25,10 @@ class CategoryPage extends React.Component {
render() {
return (
<>
-
- Categories
- {!this.state.selected ? this.state.loadedtags.length + " different Tags" : this.state.selected}
-
-
+
+
Default Tags:
All
diff --git a/src/pages/HomePage/HomePage.js b/src/pages/HomePage/HomePage.js
index 438833e..bd96175 100644
--- a/src/pages/HomePage/HomePage.js
+++ b/src/pages/HomePage/HomePage.js
@@ -4,7 +4,7 @@ import Tag from "../../elements/Tag/Tag";
import VideoContainer from "../../elements/VideoContainer/VideoContainer";
import "./HomePage.css"
-import "../../css/DefaultPage.css"
+import PageTitle from "../../elements/PageTitle/PageTitle";
class HomePage extends React.Component {
constructor(props, context) {
@@ -121,9 +121,9 @@ class HomePage extends React.Component {
render() {
return (
-
-
Home Page
-
{this.state.tag} Videos - {this.state.selectionnr}
+
-
-
+
Infos:
diff --git a/src/pages/HomePage/HomePage.test.js b/src/pages/HomePage/HomePage.test.js
index 02bbf18..5e23abb 100644
--- a/src/pages/HomePage/HomePage.test.js
+++ b/src/pages/HomePage/HomePage.test.js
@@ -52,14 +52,14 @@ describe('', function () {
it('test title and nr insertions', function () {
const wrapper = shallow();
- expect(wrapper.find(".pageheadersubtitle").text()).toBe("All Videos - 0");
+ expect(wrapper.find("PageTitle").props().subtitle).toBe("All Videos - 0");
wrapper.setState({
tag: "testtag",
selectionnr: 42
});
- expect(wrapper.find(".pageheadersubtitle").text()).toBe("testtag Videos - 42");
+ expect(wrapper.find("PageTitle").props().subtitle).toBe("testtag Videos - 42");
});
it('test search field', done => {
diff --git a/src/pages/Player/Player.js b/src/pages/Player/Player.js
index 4bfb99f..5de08da 100644
--- a/src/pages/Player/Player.js
+++ b/src/pages/Player/Player.js
@@ -4,6 +4,7 @@ import {PlyrComponent} from 'plyr-react';
import SideBar from "../../elements/SideBar/SideBar";
import Tag from "../../elements/Tag/Tag";
import AddTagPopup from "../../elements/AddTagPopup/AddTagPopup";
+import PageTitle from "../../elements/PageTitle/PageTitle";
class Player extends React.Component {
@@ -48,11 +49,10 @@ class Player extends React.Component {
render() {
return (
-
- Watch
- {this.state.movie_name}
-
-
+
+
Infos:
diff --git a/src/pages/RandomPage/RandomPage.js b/src/pages/RandomPage/RandomPage.js
index 612a8a8..27eaa0c 100644
--- a/src/pages/RandomPage/RandomPage.js
+++ b/src/pages/RandomPage/RandomPage.js
@@ -3,6 +3,7 @@ import Preview from "../../elements/Preview/Preview";
import "./RandomPage.css"
import SideBar from "../../elements/SideBar/SideBar";
import Tag from "../../elements/Tag/Tag";
+import PageTitle from "../../elements/PageTitle/PageTitle";
class RandomPage extends React.Component {
constructor(props, context) {
@@ -21,11 +22,10 @@ class RandomPage extends React.Component {
render() {
return (
-
- Random Videos
- 4pc
-
-
+
+
Visible Tags:
{this.state.tags.map((m) => (
diff --git a/src/pages/SettingsPage/SettingsPage.js b/src/pages/SettingsPage/SettingsPage.js
index 40c35d1..776dae8 100644
--- a/src/pages/SettingsPage/SettingsPage.js
+++ b/src/pages/SettingsPage/SettingsPage.js
@@ -1,5 +1,5 @@
import React from "react";
-import "../../css/DefaultPage.css"
+import PageTitle from "../../elements/PageTitle/PageTitle";
class SettingsPage extends React.Component {
@@ -44,11 +44,9 @@ class SettingsPage extends React.Component {
render() {
return (
-
- Settings Page
- todo
-
-
+