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

Create psammead grid wrappers #6618

Closed
wants to merge 20 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented May 22, 2020

Part of #3686

Overall change:

Create Grid containers based on psammead-grid and use them to replace Grid implementation found in simorgh.

Code changes:

  • Created MediumContentContainer to be used as a content wrapper that centres the contents of ArticlePage, PhotoGalleryPage, MediaAssetPage .
  • Created GridItemMedium to match the properties of GridItemConstrainedMedium.
  • Created GridItemSmall to match the properties of GridItemConstrainedSmall.
  • Created GridItemLarge to match the properties of GridItemConstrainedLargeNoMargin.

  • I have assigned myself to this PR and the corresponding issues
  • I have added labels to this PR for the relevant pod(s) affected by these changes
  • I have assigned this PR to the Simorgh project

Testing:

  • Automated (jest and/or cypress) tests added (for new features) or updated (for existing features)
  • If necessary, I have run the local E2E non-smoke tests relevant to my changes (CYPRESS_APP_ENV=local CYPRESS_SMOKE=false npm run test:e2e:interactive)
  • This PR requires manual testing

@ghost ghost added ws-articles Tasks for the WS Articles Team ws-media World Service Media labels May 22, 2020
@ghost ghost self-assigned this May 22, 2020
@ghost
Copy link
Author

ghost commented May 22, 2020

I know it seems there are a lot of changes in this PR. In reality the changes are very few. This are the components to review.

  • Headings
  • Image
  • Paragraph
  • StyledGrid
  • ArticlePage
  • MediaAssetPage
  • PhotoGalleryPage

@ghost ghost marked this pull request as ready for review May 22, 2020 11:11
@ghost ghost added this to Code review in Simorgh May 22, 2020
Copy link
Contributor

@simonsinclair simonsinclair left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this, @sadickisaac! It took me a while to wrap my head around the changes, so please bear with me and my questions below. 😅

@@ -63,7 +60,7 @@ const ArticleTimestamp = ({
prefix: articleTimestampPrefix,
};

const Wrapper = popOut ? PopOutGridItemMedium : GridItemConstrainedMedium;
const Wrapper = popOut ? PopOutGridItemMedium : GridItem;
Copy link
Contributor

Choose a reason for hiding this comment

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

I was trying to understand why this had changed from GridItemConstrainedMedium to GridItem and I came across GridItemMedium.

What is the difference between GridItem and GridItemMedium? They appear to be using a very similar configuration.

Copy link
Author

Choose a reason for hiding this comment

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

The difference was that GridItem applied margins and GridItemMedium had no margins. I have removed GridItemMedium and added enableMargins prop on GridItem

Comment on lines 24 to 27
const GridConstraints = {
headline: GridItemConstrainedLarge,
headline: GridItemLarge,
subheadline: GridItemConstrainedMedium,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Please can you help me understand why we have changed GridItemConstrainedLarge to GridItemLarge, but not GridItemConstrainedMedium to GridItemMedium?

Copy link
Author

Choose a reason for hiding this comment

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

I was trying to minimize the changes needed for the Grid updates to work. The next steps would be to gradually replace the old implementations in small PR's to aid faster review.

group5: 10,
};

export const MediumGridWrapper = ({ children }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I suggest we follow the same naming convention to other grid components and name the size as a suffix rather than a prefix? E.G. MediumGridWrapper to GridWrapperMedium.

Copy link
Author

Choose a reason for hiding this comment

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

That sounds good. 👍

Copy link
Author

Choose a reason for hiding this comment

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

Done here 572176c

@@ -27,6 +29,160 @@ import {
gridContainerLargeCss,
} from '../layoutGrid';

export const MediumContentContainer = styled.div`
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused by the name of this component. Please can you help me understand how it differs from MediumGridWrapper?

Copy link
Author

Choose a reason for hiding this comment

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

MediumGridWrapper now renamed to GridWrapperMedium acts as a parent grid wrapper to its children. MediumContentContainer doesn't. MediumContentContainer is meant to act as a wrapper for pages like the PhotoGallery, ArticlePage and MAP which have their contents centered on the page.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused on the naming conventions as well, I don't think MediumContentContainer is a good fit. Maybe something tied in with it being a Single column container and then maybe a comment on where the container is used to make it more clear.

children: node.isRequired,
};

export const GridItem = ({ children }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

GridItem seems very similar to GridItemMedium other than the margin configurations. It would be nice to see on the PR examples of GridItem's use so I can better understand where they are intended to be used.

Copy link
Author

Choose a reason for hiding this comment

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

They are similar. I guess this could be made to one function and pass in a prop like enableMargin

Copy link
Author

Choose a reason for hiding this comment

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

Done here 6af6c48. GridItem is used on the Paragraph and Image container.

@ghost ghost requested a review from sareh May 27, 2020 08:11
@ghost ghost moved this from Code review to PR in Progress in Simorgh Jun 2, 2020
@ghost ghost mentioned this pull request Jun 2, 2020
6 tasks
Simorgh automation moved this from PR in Progress to Done Jun 21, 2020
@amywalkerdev amywalkerdev deleted the create-psammead-grid-wrappers branch June 21, 2020 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ws-articles Tasks for the WS Articles Team ws-media World Service Media
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants