Skip to content

Conversation

SirJohn96
Copy link
Contributor

@SirJohn96 SirJohn96 commented Jul 24, 2024

#136 should be merged first.

@SirJohn96 SirJohn96 marked this pull request as draft July 29, 2024 14:00
@SirJohn96
Copy link
Contributor Author

Mobile menu is still in progress.

import styles from './image-teaser.module.css';

interface ImageTeaserProps extends GessoComponent {
export interface ImageTeaserProps extends GessoComponent {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put the export at the bottom of the file. Eventually we'll lint for this (there's an open issue on this repo), but for now, we at least want to make sure we follow that convention with any new code added.

document.removeEventListener('click', handleClickAnywhere);
document.removeEventListener('keydown', handleKeydownAnywhere);
};
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're missing your dependency array for useEffect.

}

topLevelItems.current.forEach(button => {
toggleSection(button.nextElementSibling as HTMLDivElement, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's important that the button's next sibling be a div, we should probably do a check rather than forcing it. A type predicate function might be useful here.

};
});

const toggleSection = (section: HTMLDivElement, hide: boolean) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you're using this inside your useEffect, it either needs to be inside the useEffect function or created with useCallback().

});

const toggleSection = (section: HTMLDivElement, hide: boolean) => {
const button = section.previousElementSibling as HTMLButtonElement;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same note as above. If we need the previous element sibling to be type HTMLButtonElement, we should check for that.

left: 0;
position: absolute;
top: 0;
width: 100%;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use logical properties for the size and positioning

.megaMenu > & {
border-bottom: 1px solid var(--grayscale-white);
list-style-type: none;
padding: 1.25rem 1.8125rem 1.25rem 0.8125rem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Logical properties for the border and padding

text-align: left;
transition: all 0.4s ease;
width: auto;
z-index: calc(1200 + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. You get the picture -- please take another pass through the CSS and ensure you're using logical properties rather than left/right/top/bottom in all cases.

z-index: 0;

/* stylelint-disable no-descending-specificity */
a,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The no-descending-specificity ones sometimes result in nothing making Stylelint happy so we have to disable it. If that's the case here, please include a comment about why it's necessary to turn off the linter. Obviously, if it is possible to adjust the ordering to fix the linting issue, do that instead.

Safari 14 doesn't recognize :focus-visible, so
combining with the above selector causes the entire
styles, including :hover, to be ignored.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're on Safari 17 now, so no reason to keep doing this. Go ahead and combine the selectors and take out the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants