diff --git a/package.json b/package.json index 325b954..a1c0647 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "dev": "next", + "build": "next build", + "start": "next start", + "export": "next build && next export" }, "keywords": [], "author": "", @@ -12,11 +15,7 @@ "dependencies": { "next": "^9.2.2", "react": "^16.13.0", - "react-dom": "^16.13.0" - }, - "scripts": { - "dev": "next", - "build": "next build", - "start": "next start" + "react-dom": "^16.13.0", + "unfetch": "^4.1.0" } } diff --git a/src/components/AllQuestions/index.js b/src/components/AllQuestions/index.js deleted file mode 100644 index a9b9d03..0000000 --- a/src/components/AllQuestions/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './AllQuestions' diff --git a/src/components/Feedback/index.js b/src/components/Feedback/index.js deleted file mode 100644 index 1367d36..0000000 --- a/src/components/Feedback/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Feedback' diff --git a/src/components/HomeTab/index.js b/src/components/HomeTab/index.js deleted file mode 100644 index db71c1e..0000000 --- a/src/components/HomeTab/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './HomeTab' diff --git a/src/components/LoadingIndicator/LoadingIndicator.js b/src/components/LoadingIndicator.js similarity index 100% rename from src/components/LoadingIndicator/LoadingIndicator.js rename to src/components/LoadingIndicator.js diff --git a/src/components/LoadingIndicator/index.js b/src/components/LoadingIndicator/index.js deleted file mode 100644 index 467f28d..0000000 --- a/src/components/LoadingIndicator/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './LoadingIndicator' diff --git a/src/components/Manual/index.js b/src/components/Manual/index.js deleted file mode 100644 index a66ffb8..0000000 --- a/src/components/Manual/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Manual' diff --git a/src/components/Question/Question.js b/src/components/Question.js similarity index 100% rename from src/components/Question/Question.js rename to src/components/Question.js diff --git a/src/components/Question/index.js b/src/components/Question/index.js deleted file mode 100644 index e2308da..0000000 --- a/src/components/Question/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Question' diff --git a/src/components/Subject/Subject.js b/src/components/Subject.js similarity index 100% rename from src/components/Subject/Subject.js rename to src/components/Subject.js diff --git a/src/components/Subject/index.js b/src/components/Subject/index.js deleted file mode 100644 index 1631708..0000000 --- a/src/components/Subject/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Subject' diff --git a/src/components/UserQuestions/index.js b/src/components/UserQuestions/index.js deleted file mode 100644 index b114097..0000000 --- a/src/components/UserQuestions/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './UserQuestions' diff --git a/src/components/layout.js b/src/components/layout.js new file mode 100644 index 0000000..667e167 --- /dev/null +++ b/src/components/layout.js @@ -0,0 +1,25 @@ +export default function Layout (props) { + return ( +
+
+
+ { console.log('CLOSE MENU') }} className='menuicon'> +
+
+
+ +
+ Frylabs +
+
+ { console.log('a') }} + >aaaaaaaaaa +
+
+ {props.children} +
+
+ ) +} diff --git a/src/constants.json b/src/constants.json new file mode 100644 index 0000000..b258e9e --- /dev/null +++ b/src/constants.json @@ -0,0 +1,4 @@ +{ + "serverUrl": "http://localhost:8080/", + "mobileWindowWidth": 700 +} diff --git a/src/components/HomeTab/links.json b/src/data/links.json similarity index 100% rename from src/components/HomeTab/links.json rename to src/data/links.json diff --git a/src/defaultStyles.css b/src/defaultStyles.css new file mode 100644 index 0000000..b6d97f9 --- /dev/null +++ b/src/defaultStyles.css @@ -0,0 +1,223 @@ +:root { + --text-color: #9999ff; + --bright-color: #f2f2f2; + --background-color: #212127; + --hoover-color: #202020; +} + +body { + font: normal 14px Verdana; + color: #999999; +} + +.link { + margin: 20px; + font-size: 20px; +} + +.sidebarLink { + color: var(--text-color); + text-decoration: none; +} + +.sidebar { + margin: 0; + padding: 0; + width: 200px; + background-color: #212127; + position: fixed; + height: 100%; + overflow: auto; +} + +.sidebar a { + display: block; + color: black; + padding: 16px; + text-decoration: none; + color: var(--bright-color); +} + +.sidebar a.active { + background-color: var(--text-color); + color: black; +} + +.sidebar a:hover:not(.active) { + background-color: #555; + color: white; +} + +div.content { + margin-left: 200px; + padding: 1px 16px; +} + +.menuicon div { + height: 5px; + background-color: var(--bright-color); + margin: 0px 0; + display: none; + width: 30px; +} + +.sidebarheader { + font-size: 40px; + color: var(--bright-color); + display: flex; + text-align: center; +} + +.headercontainer { + display: flex; + flex-direction: row; + align-items: center; + flex-wrap: nowrap; + position: relative; + margin: 10px; +} + +@media screen and (max-width: 700px) { + .sidebar { + width: 100%; + height: auto; + position: relative; + } + .sidebar a {float: left;} + div.content {margin-left: 0;} +} + +@media screen and (max-width: 700px) { + .menuicon div { + display: block; + margin: 6px 0; + } + + .sidebar a { + text-align: center; + float: none; + } + + .menuicon { + display: inline; + } + + .sidebaritemsconainer { + display: inline; + } + + .sidebarheader { + position: absolute; + left: 50%; + top: 50%; + transform: translateX(-50%) translateY(-50%); + } + + .codecontainer { + margin-left: 0px; + margin-right: 0px; + } + + .sitedescription { + width: 100%; + margin: 0 auto; + } +} + +.questionContainer { + margin: 10px; +} + +.questionContainer:hover { + background-color: var(--hoover-color); +} + +.question { + font-weight: bold; + font-size: 17px; + color: #ffffff; +} + +.answer { + font-size: 15px; +} + +.data { + font-size: 13px; + color: #a1a1a1; +} + +.loadingindicator { + position: fixed; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + + color: #fff; + font-size: 30px; +} + +.uquestioncontainer { + margin: 5px; +} + +.uquestioncontainer:hover { + background-color: var(--hoover-color); +} + +.uquestionscontainer { + margin: 10px; +} + +.uquestion { + font-weight: 'bold'; + font-size: 16px; + color: #fff; + margin: 5px; +} + +.uanswer { + margin: 5px; +} + +.uquestionnumber { + color: #fff; + margin: 5px; + font-size: 20px; +} + +.link { + margin: 10px; +} + +.subjectSelector { + overflow: scroll; + height: 200px; + margin: 10px; +} + +.subjItem { + font-size: 18px; + padding: 3px; + cursor: pointer; +} + +.activeSubjItem { + background-color: var(--text-color); + color: black; +} + +.searchBar { + margin: 10px; + width: 100%; + color: white; + background-color: #212127; + border: none; + font-size: 18px; +} + +.subjItem:hover:not(.activeSubjItem) { + background-color: #555; + color: white; +} diff --git a/src/pages/_app.js b/src/pages/_app.js new file mode 100644 index 0000000..9c15648 --- /dev/null +++ b/src/pages/_app.js @@ -0,0 +1,21 @@ +// import App from 'next/app' + +import '../defaultStyles.css' + +function MyApp ({ Component, pageProps }) { + return +} + +// Only uncomment this method if you have blocking data requirements for +// every single page in your application. This disables the ability to +// perform automatic static optimization, causing every page in your app to +// be server-side rendered. +// +// MyApp.getInitialProps = async (appContext) => { +// // calls page's `getInitialProps` and fills `appProps.pageProps` +// const appProps = await App.getInitialProps(appContext); +// +// return { ...appProps } +// } + +export default MyApp diff --git a/src/pages/_document.js b/src/pages/_document.js new file mode 100644 index 0000000..3076cf6 --- /dev/null +++ b/src/pages/_document.js @@ -0,0 +1,22 @@ +import Document, { Html, Head, Main, NextScript } from 'next/document' + +class MyDocument extends Document { + static async getInitialProps (ctx) { + const initialProps = await Document.getInitialProps(ctx) + return { ...initialProps } + } + + render () { + return ( + + + +
+ + + + ) + } +} + +export default MyDocument diff --git a/src/components/AllQuestions/AllQuestions.js b/src/pages/allQuestions.js similarity index 100% rename from src/components/AllQuestions/AllQuestions.js rename to src/pages/allQuestions.js diff --git a/src/components/Feedback/Feedback.js b/src/pages/feedback.js similarity index 100% rename from src/components/Feedback/Feedback.js rename to src/pages/feedback.js diff --git a/src/components/HomeTab/HomeTab.js b/src/pages/home.js similarity index 100% rename from src/components/HomeTab/HomeTab.js rename to src/pages/home.js diff --git a/src/pages/index.js b/src/pages/index.js new file mode 100644 index 0000000..d517826 --- /dev/null +++ b/src/pages/index.js @@ -0,0 +1,35 @@ + +// TODO: css remove unnecesarry stuff +// TODO: resizing +// TODO: fetch data only once? +// TODO: move manual to this module instead of api +// TODO: feedback tab +// TODO: motd +import Layout from '../components/layout' + +import links from '../data/links.json' +// import constants from '../constants.json' + +export default function Index (props) { + return ( + +
+ {Object.keys(links).map((key) => { + let link = links[key] + return ( + + ) + })} +
+
+ ) +} diff --git a/src/components/Manual/Manual.js b/src/pages/manual.js similarity index 85% rename from src/components/Manual/Manual.js rename to src/pages/manual.js index 10a74fc..e5d396e 100644 --- a/src/components/Manual/Manual.js +++ b/src/pages/manual.js @@ -1,8 +1,9 @@ import React, { PureComponent } from 'react' +import fetch from 'unfetch' -import LoadingIndicator from '../LoadingIndicator' +import LoadingIndicator from '../components/LoadingIndicator' -import constants from '../../constants.json' +import constants from '../constants.json' class Manual extends PureComponent { constructor (props) { diff --git a/src/components/UserQuestions/UserQuestions.js b/src/pages/userQuestions.js similarity index 100% rename from src/components/UserQuestions/UserQuestions.js rename to src/pages/userQuestions.js