mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
add file
This commit is contained in:
parent
59357e92fe
commit
df9b44d061
3 changed files with 31 additions and 42 deletions
|
@ -1,8 +1,20 @@
|
||||||
|
import { Button } from "@mui/material";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider";
|
import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider";
|
||||||
|
import { useState } from "react";
|
||||||
|
import "./bio.css";
|
||||||
|
import "../styles/colors.css";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import EditSquareIcon from "@mui/icons-material/EditSquare";
|
||||||
|
import ButtonPrimary from "./ButtonPrimary";
|
||||||
|
|
||||||
export default function MultilineTextFields() {
|
export default function MultilineTextFields() {
|
||||||
|
const toggleEditMode = () => {
|
||||||
|
isEditable(!editMode);
|
||||||
|
};
|
||||||
|
const [editMode, isEditable] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledEngineProvider injectFirst>
|
<StyledEngineProvider injectFirst>
|
||||||
<Box
|
<Box
|
||||||
|
@ -15,11 +27,20 @@ export default function MultilineTextFields() {
|
||||||
<TextField
|
<TextField
|
||||||
className="bio-input"
|
className="bio-input"
|
||||||
id="outlined-multiline-flexible"
|
id="outlined-multiline-flexible"
|
||||||
label="Multiline"
|
label="Bio"
|
||||||
multiline
|
multiline
|
||||||
maxRows={4}
|
maxRows={4}
|
||||||
|
disabled={!editMode}
|
||||||
/>
|
/>
|
||||||
|
<IconButton aria-label="edit-bio">
|
||||||
|
<EditSquareIcon
|
||||||
|
className="edit-icon"
|
||||||
|
onClick={toggleEditMode}
|
||||||
|
style={{ display: editMode ? "none" : "block" }}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
{editMode && <ButtonPrimary value={"Ok"} onClick={toggleEditMode} />}
|
||||||
</Box>
|
</Box>
|
||||||
</StyledEngineProvider>
|
</StyledEngineProvider>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.css-53g0n7-MuiButtonBase-root-MuiIconButton-root {
|
||||||
|
justify-content: end;
|
||||||
|
}
|
||||||
|
|
||||||
/* Root class for the input field */
|
/* Root class for the input field */
|
||||||
.bio-input .MuiOutlinedInput-root {
|
.bio-input .MuiOutlinedInput-root {
|
||||||
color: var(--Rotkehlchen-gray);
|
color: var(--Rotkehlchen-gray);
|
||||||
|
@ -28,10 +32,10 @@
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media only screen and (min-width: 768px) {
|
||||||
.bio-input {
|
.bio-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
.bio-input .MuiInputLabel-outlined {
|
.bio-input .MuiInputLabel-outlined {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
|
|
@ -15,12 +15,9 @@ import {
|
||||||
TextField
|
TextField
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import ChangeAvatarDialog from "../components/ChangeAvatarDialog";
|
import ChangeAvatarDialog from "../components/ChangeAvatarDialog";
|
||||||
|
import Bio from "../components/Bio";
|
||||||
|
|
||||||
function Profile() {
|
function Profile() {
|
||||||
const toggleEditMode = () => {
|
|
||||||
isEditable(!editMode);
|
|
||||||
};
|
|
||||||
const [editMode, isEditable] = useState(true);
|
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
|
@ -64,42 +61,9 @@ function Profile() {
|
||||||
{username}
|
{username}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<Bio/>
|
||||||
>
|
|
||||||
<Box
|
|
||||||
component="form"
|
|
||||||
sx={{
|
|
||||||
"& .MuiTextField-root": {
|
|
||||||
m: 1,
|
|
||||||
width: "30ch",
|
|
||||||
maxWidth: "100%",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
noValidate
|
|
||||||
autoComplete="off"
|
|
||||||
onClick={editMode ? toggleEditMode : undefined}
|
|
||||||
>
|
|
||||||
<TextField
|
|
||||||
className="bio-input"
|
|
||||||
id="outlined-multiline-flexible"
|
|
||||||
label="✎ Bio"
|
|
||||||
defaultValue="This is a sample bio. Click to edit."
|
|
||||||
multiline
|
|
||||||
maxRows={4}
|
|
||||||
disabled={editMode}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
{!editMode && (
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
className="button"
|
|
||||||
onClick={toggleEditMode}
|
|
||||||
>
|
|
||||||
Ok
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<Divider variant="middle" className="divider" />
|
<Divider variant="middle" className="divider" />
|
||||||
|
{/* TODO: Change data to data from Database */}
|
||||||
<div className="numeral-data">
|
<div className="numeral-data">
|
||||||
<div className="data">
|
<div className="data">
|
||||||
<span aria-label="current-post-number">50</span>
|
<span aria-label="current-post-number">50</span>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue