diff --git a/code/frontend/src/App.tsx b/code/frontend/src/App.tsx index d79e8a9..7d5388a 100644 --- a/code/frontend/src/App.tsx +++ b/code/frontend/src/App.tsx @@ -1,6 +1,7 @@ import "./App.css"; import "./styles/colors.css"; import "./styles/fonts.css"; +import "./styles/sizes.css"; import LoginAndSignUpPage from "./pages/LoginAndSignUpPage"; import Footer from "./components/Footer"; import Header from "./components/header"; diff --git a/code/frontend/src/components/Bio.tsx b/code/frontend/src/components/Bio.tsx index 1281d63..ebc372d 100644 --- a/code/frontend/src/components/Bio.tsx +++ b/code/frontend/src/components/Bio.tsx @@ -1,4 +1,3 @@ -import { Button } from "@mui/material"; import Box from "@mui/material/Box"; import TextField from "@mui/material/TextField"; import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider"; @@ -9,11 +8,20 @@ import IconButton from "@mui/material/IconButton"; import EditSquareIcon from "@mui/icons-material/EditSquare"; import ButtonPrimary from "./ButtonRotkehlchen"; -export default function MultilineTextFields() { +export default function BioTextField({ ownAccount }: { ownAccount: boolean }) { + const [bio, setBio] = useState(""); + const [oldBio, setOldbio] = useState(""); + const [editMode, setEditable] = useState(false); + const toggleEditMode = () => { - isEditable(!editMode); + !editMode && setOldbio(bio); + ownAccount && setEditable(!editMode); + }; + + const cancleBio = () => { + setBio(oldBio); + setEditable(false); }; - const [editMode, isEditable] = useState(false); return ( @@ -31,16 +39,35 @@ export default function MultilineTextFields() { multiline maxRows={4} disabled={!editMode} + value={bio} + onChange={(e) => setBio(e.target.value)} /> - - - + {ownAccount && ( + + + + )} - {editMode && } + {ownAccount && editMode && ( +
+ + +
+ )}
); diff --git a/code/frontend/src/components/ButtonRotkehlchen.tsx b/code/frontend/src/components/ButtonRotkehlchen.tsx index adcab78..ce001a3 100644 --- a/code/frontend/src/components/ButtonRotkehlchen.tsx +++ b/code/frontend/src/components/ButtonRotkehlchen.tsx @@ -3,15 +3,16 @@ import "./buttonRotkehlchen.css"; interface ButtonPrimaryProps { style: "primary" | "secondary"; label: string; + type: "button" | "submit" | "reset"; onClick?: () => void; } -export default function ButtonPrimary({ style, label, onClick }: ButtonPrimaryProps) { +export default function ButtonPrimary({ style, label, type, onClick }: ButtonPrimaryProps) { return ( <> {style === "primary" && (