diff --git a/frontend/src/components/BioCard.jsx b/frontend/src/components/BioCard.jsx index 5d25076..a43f28b 100644 --- a/frontend/src/components/BioCard.jsx +++ b/frontend/src/components/BioCard.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react" +import React from "react" import SanityImage from "gatsby-plugin-sanity-image" import SocialLinks from "./SocialLinks" @@ -6,51 +6,37 @@ import SocialLinks from "./SocialLinks" import * as styles from "../styles/biocard.module.css" const BioCard = ({ student }) => { - let match = "" - if (typeof window !== "undefined") { - match = window.matchMedia("(min-width: 900px)").matches - } - const [largeScreenSize, setLargeScreenSize] = useState(match) - - useEffect(() => { - if (typeof window !== "undefined") { - window.matchMedia("(min-width: 900px)").addEventListener("change", e => { - setLargeScreenSize(e.matches) - }) - } - }) - return (
- {student.name && student.surname &&

- {student.name} {student.middle ? student.middle.charAt(0) + "." : ""}{" "} - {student.surname.charAt(0) + "."} -

} - {student.studyprogramme.title &&

{student.studyprogramme.title}

} -
- {student.image && ( - - )} -
- {largeScreenSize && ( -
- -
+ {student.name && student.surname && ( +

+ {`${student.name} ${student.surname.charAt(0)}.`} +

)} + {student.studyprogramme.title && ( +

+ {student.studyprogramme.title} +

+ )} + +
+ {student.image && ( + + )} +
+
+

{student.bio.map(bio => bio.children[0].text)}

+
+
-
-

{student.bio.map((bio) => (bio.children[0].text))}

+
+
- {!largeScreenSize && ( -
- -
- )}
) } diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 78c2a1e..dd2aa25 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -1,37 +1,37 @@ -import React, { useState, useEffect } from "react"; -import { Link } from "gatsby"; -import logoDark from "../assets/images/logo-dark.svg"; -import logo from "../assets/images/logo.svg"; +import React, { useState, useEffect } from "react" +import { Link } from "gatsby" +import logoDark from "../assets/images/logo-dark.svg" +import logo from "../assets/images/logo.svg" // Style import * as style from "../styles/header.module.css" function Navbar() { - const [path, setPath] = useState(''); - const [darkMode, setDarkMode] = useState(''); + const [path, setPath] = useState("") + const [darkMode, setDarkMode] = useState("") useEffect(() => { if (typeof window !== "undefined") { - setPath(window.location.pathname); + setPath(window.location.pathname) } let colorScheme = "" if (typeof window !== "undefined") { - colorScheme = window.matchMedia("(prefers-color-scheme: dark)").matches; - setDarkMode(colorScheme); + colorScheme = window.matchMedia("(prefers-color-scheme: dark)").matches + setDarkMode(colorScheme) } if (typeof window !== "undefined") { window .matchMedia("(prefers-color-scheme: dark)") .addEventListener("change", e => { - setDarkMode(e.matches); + setDarkMode(e.matches) }) } }, []) return ( -
+