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

Fix layout issues for speakersgrid and person components. #445

Merged

Conversation

matthewgisonno
Copy link
Contributor

Description / Motivation

Fixing layout issues across breakpoints for the SpeakersGrid and Person components.
https://sugcon24eu.vercel.app/Speakers

How Has This Been Tested?

Local dev and storybook

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the Contributing guide.
  • My code/comments/docs fully adhere to the Code of Conduct.
  • My change is a code change.
  • My change is a documentation change and there are NO other updates required.

@@ -128,23 +127,26 @@ export const Default = (props: PeopleGridProps): JSX.Element => {
}

return (
<Box w="100%" mt={20} className={styles}>
<Box w="80%" pt={10} m="auto">
{(isEditorActive() || props.fields?.Headline?.value !== '') && (
Copy link
Contributor

Choose a reason for hiding this comment

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

This check was there to make sure the headline field shows in editor mode, but hides the heading field if the field is empty in regular mode. Otherwise you still have the space from an empty h2 tag.

Copy link
Contributor Author

@matthewgisonno matthewgisonno Apr 3, 2024

Choose a reason for hiding this comment

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

@ericsanner good call... I made a change to the whole usage so that it uses the JssText component, which handles the conditional rendering. If the field is empty and it's not pageEditing mode, the tag is not rendered. If the field is empty and it's in pageEditing mode, the tag is rendered so it can be edited.

<Heading as={JssText} field={props.fields.Headline} tag="h2" size="lg" />

That way the logic of showing and hiding the tag is offloaded to the JssText component and the rendering is handled by Chakra Heading component. JssText allows for a field and tag attribute as well, which are implemented here.

@lovesitecore lovesitecore merged commit 710df20 into Sitecore:main Apr 4, 2024
7 checks passed
@matthewgisonno matthewgisonno deleted the feature/speakersgrid-person-updates branch April 4, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants