Skip to content

Commit

Permalink
feat(homepage): code refactor and matching styles
Browse files Browse the repository at this point in the history
  • Loading branch information
fvives99 committed Nov 28, 2022
1 parent 72538ea commit 0ac472f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 27 deletions.
89 changes: 63 additions & 26 deletions webapp/src/components/InformationCard/ProducerInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import CountryFlag from '../CountryFlag'
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import LaunchIcon from '@mui/icons-material/Launch';



const ProducerInformation = ({ info, classes, t }) => {

console.log(info)
const [anchor, setAnchor] = useState(null)
const openPopover = (event) => {
Expand Down Expand Up @@ -53,33 +56,67 @@ const ProducerInformation = ({ info, classes, t }) => {
href={`mailto:${info.email}`}
/>

{!!info?.ownership ? (
<RowUrl title={t('ownershipDisclosure')} value={info?.ownership} />

) : null}

{!!info?.code_of_conduct ? (
<RowUrl title={t('codeofconduct')} value={info?.code_of_conduct} />


) : null}

{!!info?.chain ? (
<><><Typography variant="body1" className={classes.textEllipsis}>
{t('chainResources')}
</Typography>
<LaunchIcon>onClick={info.chain}</LaunchIcon>
<InfoOutlinedIcon onClick={openPopover}></InfoOutlinedIcon></><Popover
className={classes.shadow}
open={Boolean(anchor)}
onClose={() => setAnchor(null)}
anchorEl={anchor}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'bottom', horizontal: 'left' }}
><Link target="_blank" rel="noopener noreferrer">{info.chain}</Link>
</Popover></>
<div className={classes.flex}>
{!!info?.ownership ? (
<><><Typography variant="body1" className={classes.textEllipsis}>
{t('codeofconduct')}
</Typography>
<LaunchIcon onClick={() => window.open(info.ownership, '_blank')} className={classes.clickableIcon}>

</LaunchIcon>
<InfoOutlinedIcon className={classes.clickableIcon} onClick={openPopover}></InfoOutlinedIcon></><Popover
className={classes.shadow}
open={Boolean(anchor)}
onClose={() => setAnchor(null)}
anchorEl={anchor}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'bottom', horizontal: 'left' }}
><Link target="_blank" rel="noopener noreferrer">{info.ownership}</Link>
</Popover></>

) : null}
</div>

) : null}
<div className={classes.flex}>
{!!info?.code_of_conduct ? (
<><><Typography variant="body1" className={classes.textEllipsis}>
{t('codeofconduct')}
</Typography>
<LaunchIcon onClick={() => window.open(info.code_of_conduct, '_blank')} className={classes.clickableIcon}>

</LaunchIcon>
<InfoOutlinedIcon className={classes.clickableIcon} onClick={openPopover}></InfoOutlinedIcon></><Popover
className={classes.shadow}
open={Boolean(anchor)}
onClose={() => setAnchor(null)}
anchorEl={anchor}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'bottom', horizontal: 'left' }}
><Link target="_blank" rel="noopener noreferrer">{info.code_of_conduct}</Link>
</Popover></>

) : null}
</div>
<div className={classes.flex}>
{!!info?.chain ? (
<><><Typography variant="body1" className={classes.textEllipsis}>
{t('chainResources')}
</Typography>
<LaunchIcon onClick={() => window.open(info.chain, '_blank')} className={classes.clickableIcon}>

</LaunchIcon>
<InfoOutlinedIcon className={classes.clickableIcon} onClick={openPopover}></InfoOutlinedIcon></><Popover
className={classes.shadow}
open={Boolean(anchor)}
onClose={() => setAnchor(null)}
anchorEl={anchor}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'bottom', horizontal: 'left' }}
><Link target="_blank" rel="noopener noreferrer">{info.chain}</Link>
</Popover></>

) : null}
</div>


{!!info?.otherResources.length && (
Expand Down
11 changes: 10 additions & 1 deletion webapp/src/components/InformationCard/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default (theme) => ({
info: {
borderLeft: 'none',
'& .MuiTypography-body1': {
margin: theme.spacing(1, 0),
margin: theme.spacing(1),
display: 'flex',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
Expand Down Expand Up @@ -291,4 +291,13 @@ export default (theme) => ({
minWidth: 150,
},
},
flex:{
display: 'flex',
alignItems: 'center'
},
clickableIcon: {
'&:hover': {
color: '#1565c0',
},
},
})

0 comments on commit 0ac472f

Please sign in to comment.