Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show cookie settings by click on a respective button shown in footer #394

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion website/src/footer-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ const footerStyle = makeStyles((theme: Theme) => ({
},
legalText: {
fontWeight: theme.typography.fontWeightLight
},
toolbarManageCookies: {
fontWeight: theme.typography.fontWeightLight
}
}));

const FooterContent: React.FunctionComponent<{ expanded: boolean }> = ({ expanded }) => {
const classes = footerStyle();
const theme = useTheme();
const isSmallDisplay = useMediaQuery(theme.breakpoints.down('sm'));
const isSmallDisplay = useMediaQuery(theme.breakpoints.down('lg'));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't change the definition of isSmallDisplay to encompass up to large displays, as this will trigger on many devices where it is not intentional. What was the reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That variable is only to decide about the behaviour of the menu. Because I added the "Manage Cookies" item here, and the footer got too full for the lg size, I decided to switch to the collapsed menu in the footer at a larger state. Admittedly the naming of that variable is not suitable anymore.

const isLargeDisplay = useMediaQuery(theme.breakpoints.up('xl'));

const MainFooter = () => {
Expand Down Expand Up @@ -68,6 +71,9 @@ const FooterContent: React.FunctionComponent<{ expanded: boolean }> = ({ expande
<Box ml={itemSpacing}>
{rightsReservedText(classes)}
</Box>
<Box ml={itemSpacing}>
{manageCookies(classes)}
</Box>
</Box>
:
<>
Expand Down Expand Up @@ -99,6 +105,9 @@ const FooterContent: React.FunctionComponent<{ expanded: boolean }> = ({ expande
<Box mb={itemSpacing + 1}>
{legalResources(classes)}
</Box>
<Box mb={itemSpacing + 1}>
{manageCookies(classes)}
</Box>
</Box>
<MainFooter />
</Box>;
Expand Down Expand Up @@ -166,4 +175,22 @@ const rightsReservedText = (classes: FooterStyle) =>
All Rights Reserved.
</Box>;

const manageCookies = (classes: FooterStyle) => {
const handleClick = () => {
const ccWindow = document.getElementsByClassName('cc-window').item(0);
if(ccWindow) {
ccWindow.setAttribute('style', 'display:flex');
setTimeout(function() {
ccWindow.classList.remove('cc-invisible');
}, 20);
}
}
return <Link
onClick={handleClick}
className={classes.link + ' ' + classes.toolbarManageCookies}>
Manage Cookies
</Link>;
}


export default FooterContent;