Changeset 8d83180 for reactapp


Ignore:
Timestamp:
10/11/22 15:41:16 (2 years ago)
Author:
unknown <mlviktor23@…>
Branches:
main
Children:
c68150f
Parents:
cae16b5
Message:

forums/page nav

Location:
reactapp/src
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • reactapp/src/App.js

    rcae16b5 r8d83180  
    66import Home from "./Pages/Home";
    77import UserDashboard from "./Pages/UserDashboard";
     8import Subject from "./Pages/Subject";
     9import University from "./Pages/University";
     10import Faculty from "./Pages/Faculty";
    811import { useEffect, useState, useMemo } from "react";
    912import AuthApi from "./api/AuthApi";
     
    1114import axios from "./api/axios";
    1215import JSOG from "jsog";
     16import NotFound from "./Pages/NotFound";
    1317
    1418export default function App() {
     
    7781              />
    7882            </Route>
     83            <Route path="university/:universityId" element={<University />} />
     84            <Route path="faculty/:facultyId" element={<Faculty />} />
     85            <Route path="subject/:subjectId" element={<Subject />} />
    7986            <Route path="search" element={<SearchResults />}></Route>
    8087            <Route
     
    8794            ></Route>
    8895          </Route>
     96          <Route path="*" element={<NotFound />} />
    8997        </Routes>
    9098      </BrowserRouter>
  • reactapp/src/Components/Styled/Main.style.js

    rcae16b5 r8d83180  
    2222  color: black;
    2323`;
     24
     25export const CurrentPageNav = styled.div`
     26  font-style: italic;
     27  font-size: 14px;
     28`;
  • reactapp/src/Components/Styled/OpinionCard.style.js

    rcae16b5 r8d83180  
    88  margin-bottom: 20px;
    99  padding: 10px;
    10   border: 1px solid black;
     10  box-shadow: 2px 2px 10px #aaaaaa;
    1111`;
    1212
  • reactapp/src/Components/Styled/ProfessorCard.style.js

    rcae16b5 r8d83180  
    22
    33export const ProfessorCard = styled.div`
    4   background-color: papayawhip;
     4  background-color: cornsilk;
    55  width: auto;
    66  padding: 10px;
    77  margin-bottom: 30px;
    8   margin-top: 140px;
     8  margin-top: 40px;
    99`;
    1010
  • reactapp/src/Pages/Professor.js

    rcae16b5 r8d83180  
    2323import { useNavigate } from "react-router-dom";
    2424import axios from "../api/axios";
     25import { CurrentPageNav } from "../Components/Styled/Main.style";
    2526
    2627function Professor(user, userLoaded) {
     
    3435  const [postTitle, setPostTitle] = useState("");
    3536  const [postContent, setPostContent] = useState("");
     37  const [fetchError, setFetchError] = useState(false);
    3638
    3739  useEffect(() => {
     
    4749        setLoaded(true);
    4850      } catch (error) {
    49         console.log("Fetching error", error);
     51        setFetchError(true);
    5052      }
    5153    };
     
    9597    return (
    9698      <div>
     99        <CurrentPageNav>
     100          &#187;{" "}
     101          <a href={"/university/" + professor.faculty.university.universityId}>
     102            {professor.faculty.university.universityName}
     103          </a>{" "}
     104          &#187;{" "}
     105          <a href={"/faculty/" + professor.faculty.facultyId}>
     106            {professor.faculty.facultyName}
     107          </a>{" "}
     108          &#187; <a href="#">{professor.professorName}</a>
     109        </CurrentPageNav>
    97110        <ProfessorCard>
    98111          <ProfessorCardName>{professor.professorName}</ProfessorCardName>
     
    168181      </div>
    169182    );
    170   } else {
     183  } else if (!fetchError) {
    171184    return (
    172185      <div>
     
    175188      </div>
    176189    );
     190  } else {
     191    return (
     192      <div style={{ marginTop: "140px" }}>
     193        <h1 style={{ textAlign: "center" }}>Страницата не е пронајдена.</h1>
     194      </div>
     195    );
    177196  }
    178197}
Note: See TracChangeset for help on using the changeset viewer.