-
Notifications
You must be signed in to change notification settings - Fork 54
Add scripLink prop to render ScriptLink
component
#2474
Conversation
763e013
to
e901681
Compare
2f0214a
to
6907262
Compare
Co-Authored-By: Jamie Blaut <jagoda.blaut@bbc.co.uk>
Co-Authored-By: Jamie Blaut <jagoda.blaut@bbc.co.uk>
There was a problem hiding this 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
Co-Authored-By: Ruth Bochere <ruth.ogendi@andela.com>
Co-Authored-By: Ruth Bochere <ruth.ogendi@andela.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
} | ||
position: absolute; | ||
${({ dir }) => (dir === 'ltr' ? 'right: 0' : 'left: 0')}; | ||
top: calc(50% - 1.5rem); |
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DenisHdz Good point. Done 😎
lgtm |
Resolves #2467
Overall change: Integrate
ScriptLink
to Brand.Code changes:
scriptLink
prop to render the passed<ScriptLink/>
.