-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from JeanVegaD/edit-profile-design
Redesign edit profile section
- Loading branch information
Showing
13 changed files
with
518 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,77 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import Logo from '../Logo' | ||
import TextField from '@material-ui/core/TextField' | ||
import Typography from '@material-ui/core/Typography' | ||
import Box from '@material-ui/core/Box' | ||
import { useTranslation } from 'react-i18next' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import StorefrontIcon from '@material-ui/icons/Storefront' | ||
import LocalHospitalIcon from '@material-ui/icons/LocalHospital' | ||
import Avatar from '@material-ui/core/Avatar' | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
textField: { | ||
marginTop: theme.spacing(2) | ||
}, | ||
box: { | ||
width: '100%' | ||
width: '100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center' | ||
}, | ||
avatarRoundDesktop: { | ||
width: '90px', | ||
height: '90px', | ||
border: 'solid 2px rgba(0, 0, 0, 0.04)', | ||
[theme.breakpoints.down('md')]: { | ||
width: '70px', | ||
height: '70px', | ||
}, | ||
marginTop: '10px', | ||
marginBottom: '10px' | ||
}, | ||
logoTitle: { | ||
textAlign: 'center' | ||
} | ||
})) | ||
|
||
const LogoUrlInput = ({ handleSetField, logo }) => { | ||
const LogoUrlInput = ({ handleSetField, logo, role }) => { | ||
const { t } = useTranslation('translations') | ||
const classes = useStyles() | ||
return ( | ||
<Box className={classes.box} display="flex" flexDirection="column"> | ||
{logo && logo.length > 0 ? ( | ||
<> | ||
<Typography className={classes.logoTitle} variant="h4"> | ||
Logo | ||
</Typography> | ||
<br /> | ||
<Logo | ||
showDeleteButton | ||
logoUrl={logo} | ||
deleteActualLogo={(deleteLogo) => { | ||
if (deleteLogo) handleSetField('logo_url', '') | ||
}} | ||
/> | ||
</> | ||
) : ( | ||
<TextField | ||
id="logo-url" | ||
name="logo-input" | ||
label={t('editProfile.logoUrl')} | ||
variant="outlined" | ||
placeholder={t('editProfile.logoUrlPlaceholder')} | ||
defaultValue={logo} | ||
fullWidth | ||
InputLabelProps={{ | ||
shrink: true | ||
}} | ||
className={classes.textField} | ||
onChange={(event) => { | ||
if (event.target.value.length > 0) | ||
handleSetField('logo_url', event.target.value) | ||
}} | ||
/> | ||
)} | ||
<Box className={classes.box}> | ||
<Avatar | ||
className={classes.avatarRoundDesktop} | ||
src={logo ? `//images.weserv.nl?url=${logo}&h=300&dpr=2` : ''} | ||
> | ||
{role === "sponsor" && <StorefrontIcon />} | ||
{role === "lifebank" && <LocalHospitalIcon />} | ||
</Avatar> | ||
<TextField | ||
id="logo-url" | ||
name="logo-input" | ||
label={t('editProfile.logoUrl')} | ||
variant="outlined" | ||
placeholder={t('editProfile.logoUrlPlaceholder')} | ||
defaultValue={logo} | ||
fullWidth | ||
InputLabelProps={{ | ||
shrink: true | ||
}} | ||
className={classes.textField} | ||
onChange={(event) => { | ||
if (event.target.value.length > 0) | ||
handleSetField('logo_url', event.target.value) | ||
}} | ||
/> | ||
</Box> | ||
|
||
) | ||
} | ||
|
||
LogoUrlInput.propTypes = { | ||
handleSetField: PropTypes.func, | ||
logo: PropTypes.string | ||
logo: PropTypes.string, | ||
role: PropTypes.string, | ||
} | ||
|
||
export default LogoUrlInput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.