From 720c218a1196c9cd3abcd41647673aea99a88292 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Wed, 8 Jul 2020 00:14:08 +0200 Subject: [PATCH] moved all css files to module files to seperate into namespaces and prevent name overlaps --- package.json | 2 +- src/elements/PageTitle/PageTitle.js | 8 +++--- .../{PageTitle.css => PageTitle.module.css} | 0 src/elements/Preview/Preview.js | 18 ++++++------- .../{Preview.css => Preview.module.css} | 0 src/elements/SideBar/SideBar.js | 20 ++++++++++++-- .../{SideBar.css => SideBar.module.css} | 0 src/elements/Tag/Tag.js | 4 +-- src/elements/Tag/{Tag.css => Tag.module.css} | 0 src/elements/VideoContainer/VideoContainer.js | 3 ++- .../VideoContainer/VideoContainer.module.css | 4 +++ src/pages/CategoryPage/CategoryPage.js | 7 ++--- src/pages/HomePage/HomePage.js | 26 +++++++++---------- .../{HomePage.css => HomePage.module.css} | 5 ---- src/pages/Player/Player.js | 22 +++++++--------- .../Player/{Player.css => Player.module.css} | 11 -------- src/pages/RandomPage/RandomPage.js | 10 +++---- .../{RandomPage.css => RandomPage.module.css} | 0 18 files changed, 72 insertions(+), 68 deletions(-) rename src/elements/PageTitle/{PageTitle.css => PageTitle.module.css} (100%) rename src/elements/Preview/{Preview.css => Preview.module.css} (100%) rename src/elements/SideBar/{SideBar.css => SideBar.module.css} (100%) rename src/elements/Tag/{Tag.css => Tag.module.css} (100%) create mode 100644 src/elements/VideoContainer/VideoContainer.module.css rename src/pages/HomePage/{HomePage.css => HomePage.module.css} (67%) rename src/pages/Player/{Player.css => Player.module.css} (63%) rename src/pages/RandomPage/{RandomPage.css => RandomPage.module.css} (100%) diff --git a/package.json b/package.json index e2c5e69..c13873a 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "text-summary" ] }, - "proxy": "http://192.168.0.248", + "proxy": "http://192.168.0.42", "homepage": "/", "eslintConfig": { "extends": "react-app" diff --git a/src/elements/PageTitle/PageTitle.js b/src/elements/PageTitle/PageTitle.js index b7ef224..cce4ec9 100644 --- a/src/elements/PageTitle/PageTitle.js +++ b/src/elements/PageTitle/PageTitle.js @@ -1,5 +1,5 @@ import React from "react"; -import "./PageTitle.css" +import style from "./PageTitle.module.css" class PageTitle extends React.Component { constructor(props) { @@ -11,9 +11,9 @@ class PageTitle extends React.Component { render() { return ( -
- {this.props.title} - {this.props.subtitle} +
+ {this.props.title} + {this.props.subtitle} <> {this.props.children} diff --git a/src/elements/PageTitle/PageTitle.css b/src/elements/PageTitle/PageTitle.module.css similarity index 100% rename from src/elements/PageTitle/PageTitle.css rename to src/elements/PageTitle/PageTitle.module.css diff --git a/src/elements/Preview/Preview.js b/src/elements/Preview/Preview.js index c3a6810..03bbf9b 100644 --- a/src/elements/Preview/Preview.js +++ b/src/elements/Preview/Preview.js @@ -1,5 +1,5 @@ import React from "react"; -import "./Preview.css"; +import style from "./Preview.module.css"; import Player from "../../pages/Player/Player"; import {Spinner} from "react-bootstrap"; @@ -38,17 +38,17 @@ class Preview extends React.Component { render() { return ( -
this.itemClick()}> -
{this.state.name}
-
+
this.itemClick()}> +
{this.state.name}
+
{this.state.previewpicture != null ? - Pic loading. : - } + }
-
+
@@ -68,8 +68,8 @@ class Preview extends React.Component { export class TagPreview extends React.Component { render() { return ( -
this.itemClick()}> -
+
this.itemClick()}> +
{this.props.name}
diff --git a/src/elements/Preview/Preview.css b/src/elements/Preview/Preview.module.css similarity index 100% rename from src/elements/Preview/Preview.css rename to src/elements/Preview/Preview.module.css diff --git a/src/elements/SideBar/SideBar.js b/src/elements/SideBar/SideBar.js index 9899adf..9375f33 100644 --- a/src/elements/SideBar/SideBar.js +++ b/src/elements/SideBar/SideBar.js @@ -1,12 +1,28 @@ import React from "react"; -import "./SideBar.css" +import style from "./SideBar.module.css" class SideBar extends React.Component { render() { - return (
+ return (
{this.props.children}
); } } +export class SideBarTitle extends React.Component { + render() { + return ( +
{this.props.children}
+ ); + } +} + +export class SideBarItem extends React.Component { + render() { + return ( +
{this.props.children}
+ ); + } +} + export default SideBar; diff --git a/src/elements/SideBar/SideBar.css b/src/elements/SideBar/SideBar.module.css similarity index 100% rename from src/elements/SideBar/SideBar.css rename to src/elements/SideBar/SideBar.module.css diff --git a/src/elements/Tag/Tag.js b/src/elements/Tag/Tag.js index db6a6b5..d4885da 100644 --- a/src/elements/Tag/Tag.js +++ b/src/elements/Tag/Tag.js @@ -1,12 +1,12 @@ import React from "react"; -import "./Tag.css" +import styles from "./Tag.module.css" import CategoryPage from "../../pages/CategoryPage/CategoryPage"; class Tag extends React.Component { render() { return ( - ); } diff --git a/src/elements/Tag/Tag.css b/src/elements/Tag/Tag.module.css similarity index 100% rename from src/elements/Tag/Tag.css rename to src/elements/Tag/Tag.module.css diff --git a/src/elements/VideoContainer/VideoContainer.js b/src/elements/VideoContainer/VideoContainer.js index 66dee33..49b820c 100644 --- a/src/elements/VideoContainer/VideoContainer.js +++ b/src/elements/VideoContainer/VideoContainer.js @@ -1,5 +1,6 @@ import React from "react"; import Preview from "../Preview/Preview"; +import style from "./VideoContainer.module.css" class VideoContainer extends React.Component { constructor(props, context) { @@ -24,7 +25,7 @@ class VideoContainer extends React.Component { render() { return ( -
+
{this.state.loadeditems.map(elem => ( -
Default Tags:
+ Default Tags: { this.loadTag(e.props.category) @@ -72,7 +73,7 @@ class CategoryPage extends React.Component { onClick={this.loadCategoryPageDefault}>Back : -
+
{this.state.loadedtags ? this.state.loadedtags.map((m) => ( + <> -
{ + { e.preventDefault(); this.searchVideos(this.keyword); }}> @@ -137,15 +137,15 @@ class HomePage extends React.Component {
-
Infos:
+ Infos:
-
{this.state.sideinfo.videonr} Videos Total!
-
{this.state.sideinfo.fullhdvideonr} FULL-HD Videos!
-
{this.state.sideinfo.hdvideonr} HD Videos!
-
{this.state.sideinfo.sdvideonr} SD Videos!
-
{this.state.sideinfo.tagnr} different Tags!
+ {this.state.sideinfo.videonr} Videos Total! + {this.state.sideinfo.fullhdvideonr} FULL-HD Videos! + {this.state.sideinfo.hdvideonr} HD Videos! + {this.state.sideinfo.sdvideonr} SD Videos! + {this.state.sideinfo.tagnr} different Tags!
-
Default Tags:
+ Default Tags: All FullHd LowQuality @@ -156,11 +156,11 @@ class HomePage extends React.Component { data={this.state.data} viewbinding={this.props.viewbinding}/> :
No Data found!
} -
+
-
+ ); } } diff --git a/src/pages/HomePage/HomePage.css b/src/pages/HomePage/HomePage.module.css similarity index 67% rename from src/pages/HomePage/HomePage.css rename to src/pages/HomePage/HomePage.module.css index 1b4b6a5..977257e 100644 --- a/src/pages/HomePage/HomePage.css +++ b/src/pages/HomePage/HomePage.module.css @@ -1,8 +1,3 @@ -.maincontent { - float: left; - width: 70%; -} - .rightinfo { float: left; width: 10%; diff --git a/src/pages/Player/Player.js b/src/pages/Player/Player.js index 1883160..c486804 100644 --- a/src/pages/Player/Player.js +++ b/src/pages/Player/Player.js @@ -1,7 +1,7 @@ import React from "react"; -import "./Player.css" +import style from "./Player.module.css" import {PlyrComponent} from 'plyr-react'; -import SideBar from "../../elements/SideBar/SideBar"; +import SideBar, {SideBarTitle, SideBarItem} from "../../elements/SideBar/SideBar"; import Tag from "../../elements/Tag/Tag"; import AddTagPopup from "../../elements/AddTagPopup/AddTagPopup"; import PageTitle from "../../elements/PageTitle/PageTitle"; @@ -52,17 +52,15 @@ class Player extends React.Component { subtitle={this.state.movie_name}/> -
Infos:
+ Infos:
-
{this.state.likes} Likes!
+ {this.state.likes} Likes! {this.state.quality !== 0 ? -
{this.state.quality}p Quality! -
: null} + {this.state.quality}p Quality! : null} {this.state.length !== 0 ? -
{Math.round(this.state.length / 60)} Minutes of length! -
: null} + {Math.round(this.state.length / 60)} Minutes of length!: null}
-
Tags:
+ Tags: {this.state.tags.map((m) => ( -
+
{/* video component is added here */} {this.state.sources ? :
not loaded yet
} -
+
- +
); } diff --git a/src/pages/Player/Player.css b/src/pages/Player/Player.module.css similarity index 63% rename from src/pages/Player/Player.css rename to src/pages/Player/Player.module.css index 134cefd..a313388 100644 --- a/src/pages/Player/Player.css +++ b/src/pages/Player/Player.module.css @@ -8,17 +8,6 @@ margin-left: 25px; } -.likefield { - margin-top: 15px; - margin-left: 15px; - margin-right: 15px; - height: 30px; - background-color: #9e5353; - border-radius: 10px; - text-align: center; - color: white; -} - .videowrapper { margin-left: 20px; display: block; diff --git a/src/pages/RandomPage/RandomPage.js b/src/pages/RandomPage/RandomPage.js index 3261aa5..9420dad 100644 --- a/src/pages/RandomPage/RandomPage.js +++ b/src/pages/RandomPage/RandomPage.js @@ -1,7 +1,7 @@ import React from "react"; import Preview from "../../elements/Preview/Preview"; -import "./RandomPage.css" -import SideBar from "../../elements/SideBar/SideBar"; +import style from "./RandomPage.module.css" +import SideBar, {SideBarTitle} from "../../elements/SideBar/SideBar"; import Tag from "../../elements/Tag/Tag"; import PageTitle from "../../elements/PageTitle/PageTitle"; @@ -27,7 +27,7 @@ class RandomPage extends React.Component { subtitle='4pc'/> -
Visible Tags:
+ Visible Tags: {this.state.tags.map((m) => ( ))} -
- +
+
diff --git a/src/pages/RandomPage/RandomPage.css b/src/pages/RandomPage/RandomPage.module.css similarity index 100% rename from src/pages/RandomPage/RandomPage.css rename to src/pages/RandomPage/RandomPage.module.css