import React, { useState } from "react"; import DialogTitle from "@material-ui/core/DialogTitle"; import DialogContent from "@material-ui/core/DialogContent"; import Dialog from "@material-ui/core/Dialog"; import Divider from "@material-ui/core/Divider"; import { makeStyles } from "@material-ui/core/styles"; import ButtonSecondary from "../Input/ButtonSecondary"; import ButtonPrimary from "../Input/ButtonPrimary"; import IconButton from "@material-ui/core/IconButton"; import TextField from "@material-ui/core/TextField"; import CloseIcon from "@material-ui/icons/Close"; import { useSelector } from "react-redux"; import { useHistory } from "react-router-dom"; const useStyles = makeStyles((theme) => ({ root: { textAlign: "center", "& .MuiPaper-root": { minWidth: "30%", backgroundColor: "#262626", color: "#bbbbbb", }, }, closeButton: { color: "#bbbbbb", position: "absolute", right: theme.spacing(1), top: theme.spacing(1), }, textInput: { margin: theme.spacing(2), "& .MuiInputBase-root": { color: "#bbbbbb", }, "& .MuiInputLabel-root": { color: "#bbbbbb", }, }, textInputFullWidth: { marginTop: theme.spacing(2), marginBottom: theme.spacing(2), "& .MuiInputBase-root": { color: "#bbbbbb", }, "& .MuiInputLabel-root": { color: "#bbbbbb", }, "$ .MuiFormHelperText-root": { color: "#bbbbbb", }, }, timePicker: { margin: theme.spacing(2), "& .MuiInputBase-root": { color: "#bbbbbb", }, "& .MuiInputLabel-root": { color: "#bbbbbb", }, }, stepLabel: { "& .MuiStepLabel-label": { color: "#bbbbbb", }, "& .MuiStepLabel-active": { color: "#bbbbbb", }, }, })); export default function Settings() { const history = useHistory(); const style = useStyles(); const data = useSelector((state) => state.data.userData); const initialState = { firstname: data.firstname, lastname: data.lastname, email: data.userEmail, NIP: data.billing.NIP, adress: data.billing.adress, companyName: data.billing.companyName, }; const [state, setState] = useState(initialState); return ( Ustawienia konta {}} aria-label="close" > setState({ ...state, firstname: event.target.value }) } label="ImiÄ™" variant="outlined" /> setState({ ...state, lastname: event.target.value }) } label="Nazwisko" variant="outlined" /> setState({ ...state, email: event.target.value }) } label="Email" variant="outlined" /> setState({ ...state, companyName: event.target.value }) } label="Nazwa firmy" variant="outlined" /> setState({ ...state, NIP: event.target.value })} label="NIP" variant="outlined" /> setState({ ...state, adress: event.target.value }) } label="Adres firmy" variant="outlined" /> history.push("/")} text="Anuluj" /> ); }