Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Add scripLink prop to render ScriptLink component #2474

Merged
15 commits merged into from
Oct 29, 2019
Merged

Conversation

ghost
Copy link

@ghost ghost commented Oct 23, 2019

Resolves #2467

Overall change: Integrate ScriptLink to Brand.

Code changes:

  • Add scriptLink prop to render the passed <ScriptLink/>.
  • Add assertion tests to test that the script link is rendered correctly.
  • Update snapshots.

  • I have assigned myself to this PR and the corresponding issues
  • Automated jest tests added (for new features) or updated (for existing features)
  • This PR requires manual testing

@ghost ghost added the ws-home Tasks for the WS Home Team label Oct 23, 2019
@ghost ghost self-assigned this Oct 23, 2019
@ghost ghost marked this pull request as ready for review October 23, 2019 12:50
@ghost ghost force-pushed the IntegrateScriptLink branch from 763e013 to e901681 Compare October 23, 2019 12:55
@ghost ghost force-pushed the IntegrateScriptLink branch from 2f0214a to 6907262 Compare October 23, 2019 13:35
@j-pendlebury j-pendlebury added ws-articles Tasks for the WS Articles Team shared-components labels Oct 23, 2019
packages/components/psammead-brand/CHANGELOG.md Outdated Show resolved Hide resolved
packages/components/psammead-brand/README.md Outdated Show resolved Hide resolved
sadickisaac and others added 2 commits October 23, 2019 17:32
Co-Authored-By: Jamie Blaut <jagoda.blaut@bbc.co.uk>
Co-Authored-By: Jamie Blaut <jagoda.blaut@bbc.co.uk>
@ghost ghost requested a review from j-pendlebury October 23, 2019 14:32
Copy link
Contributor

@j-pendlebury j-pendlebury left a comment

Choose a reason for hiding this comment

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

looks fine to me

sadickisaac and others added 2 commits October 23, 2019 18:01
Co-Authored-By: Ruth Bochere <ruth.ogendi@andela.com>
Co-Authored-By: Ruth Bochere <ruth.ogendi@andela.com>
@ghost ghost requested a review from Bopchy October 23, 2019 15:01
Copy link
Contributor

@Bopchy Bopchy left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@ghost ghost added ws-articles Tasks for the WS Articles Team and removed ws-articles Tasks for the WS Articles Team labels Oct 23, 2019
}
position: absolute;
${({ dir }) => (dir === 'ltr' ? 'right: 0' : 'left: 0')};
top: calc(50% - 1.5rem);
Copy link
Contributor

Choose a reason for hiding this comment

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

The top calculation is wrong when the screen is small, making the link to go outside the banner when it should stay in it.

brand-wrong

brand-right

Instead of making it absolute and calculate the top position, an alternative would be to add a new div to wrap both, Brand and Script Link, and use flex to align the items vertically and put them on each side. And then you wouldn't need ScriptLinkWrapper and SvgWrapper, just to apply a couple of tweaks to the Banner height and padding. Up to you :)

const StyledWrapper = styled.div`
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  max-width: ${GEL_GROUP_5_SCREEN_WIDTH_MIN};
  margin: 0 auto;
`;
  <Banner
      svgHeight={svgHeight}
      borderTop={borderTop}
      borderBottom={borderBottom}
      backgroundColour={backgroundColour}
      logoColour={logoColour}
      {...rest}
    >
      <StyledWrapper>
        {url ? (
          <StyledLink href={url} maxWidth={maxWidth} minWidth={minWidth}>
            <StyledBrand {...props} />
          </StyledLink>
        ) : (
          <StyledBrand {...props} />
        )}
        {scriptLinkComponent}
      </StyledWrapper>
    </Banner>

Copy link
Author

Choose a reason for hiding this comment

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

@DenisHdz Good point. Done 😎

@ghost ghost requested a review from DenisHdz October 24, 2019 03:36
@PriyaKR PriyaKR assigned PriyaKR and unassigned PriyaKR Oct 28, 2019
@jamesbrumpton
Copy link
Contributor

lgtm

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
shared-components ws-articles Tasks for the WS Articles Team ws-home Tasks for the WS Home Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate ScriptLink into the Brand Component
7 participants