Skip to content

Commit

Permalink
Remove GridItemMedium
Browse files Browse the repository at this point in the history
  • Loading branch information
sadick254 committed May 26, 2020
1 parent 76683a0 commit 6af6c48
Show file tree
Hide file tree
Showing 6 changed files with 1,601 additions and 1,337 deletions.
4 changes: 2 additions & 2 deletions src/app/containers/Image/index.jsx
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import filterForBlockType from '#lib/utilities/blockHandlers';
import { imageModelPropTypes } from '#models/propTypes/image';
import ArticleFigure from '../ArticleFigure';
import { GridItemMedium, GridItemSmall, GridItemLarge } from '#lib/styledGrid';
import { GridItem, GridItemSmall, GridItemLarge } from '#lib/styledGrid';
import { createSrcset } from '#lib/utilities/srcSet';
import buildIChefURL from '#lib/utilities/ichefURL';
import urlWithPageAnchor from '#lib/utilities/pageAnchor';
Expand Down Expand Up @@ -57,7 +57,7 @@ const ImageContainer = ({ blocks, position }) => {
let Wrapper = GridItemLarge;

if (height === width) {
Wrapper = GridItemMedium;
Wrapper = GridItem;
}
if (height > width) {
Wrapper = GridItemSmall;
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/Paragraph/index.jsx
Expand Up @@ -14,7 +14,7 @@ const ParagraphContainer = ({ blocks }) => {
const { script, service } = useContext(ServiceContext);

return (
<GridItem>
<GridItem enableMargins>
<Paragraph script={script} service={service}>
<Blocks blocks={blocks} componentsToRender={componentsToRender} />
</Paragraph>
Expand Down
42 changes: 18 additions & 24 deletions src/app/lib/styledGrid/index.jsx
Expand Up @@ -52,6 +52,15 @@ const mediumColumns = {
group5: 10,
};

const noMargins = {
group0: false,
group1: false,
group2: false,
group3: false,
group4: false,
group5: false,
};

export const GridWrapperMedium = ({ children }) => {
return (
<Grid
Expand All @@ -68,8 +77,8 @@ GridWrapperMedium.propTypes = {
children: node.isRequired,
};

export const GridItem = ({ children }) => {
const margins = {
export const GridItem = ({ children, enableMargins }) => {
const gridMargins = {
group0: true,
group1: true,
group2: true,
Expand All @@ -78,6 +87,8 @@ export const GridItem = ({ children }) => {
group5: false,
};

const margins = enableMargins ? gridMargins : noMargins;

return (
<Grid
item
Expand All @@ -92,6 +103,11 @@ export const GridItem = ({ children }) => {

GridItem.propTypes = {
children: node.isRequired,
enableMargins: bool,
};

GridItem.defaultProps = {
enableMargins: false,
};

export const GridItemSmall = ({ children }) => {
Expand Down Expand Up @@ -130,15 +146,6 @@ GridItemSmall.propTypes = {
};

export const GridItemLarge = ({ children, enableMargins }) => {
const noMargins = {
group0: false,
group1: false,
group2: false,
group3: false,
group4: false,
group5: false,
};

const gridMargins = {
group0: true,
group1: true,
Expand Down Expand Up @@ -170,19 +177,6 @@ GridItemLarge.propTypes = {
GridItemLarge.defaultProps = {
enableMargins: false,
};

export const GridItemMedium = ({ children }) => {
return (
<Grid item columns={mediumColumns} parentColumns={defaultColumns}>
{children}
</Grid>
);
};

GridItemMedium.propTypes = {
children: node.isRequired,
};

export const GridWrapper = styled.div`
${layoutGridWrapper};
padding-bottom: ${GEL_SPACING_QUAD};
Expand Down
Expand Up @@ -61,7 +61,7 @@ exports[`Media Asset Page AV player should render version (live audio stream) 1`
</strong>
</div>
<div
class="GridComponent-nf79gm-0 ciLAht"
class="GridComponent-nf79gm-0 eRZeLk"
dir="ltr"
>
<time
Expand Down Expand Up @@ -438,7 +438,7 @@ exports[`Media Asset Page should render component 1`] = `
</strong>
</div>
<div
class="GridComponent-nf79gm-0 ciLAht"
class="GridComponent-nf79gm-0 eRZeLk"
dir="ltr"
>
<time
Expand Down

0 comments on commit 6af6c48

Please sign in to comment.