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

Reduce height of Brand and Script Link components #2569

Merged
merged 25 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
87fcaa3
Change script link height
OlgaLyubin Nov 5, 2019
1ceeffd
Update snapshots
OlgaLyubin Nov 5, 2019
478620e
Bump up version
OlgaLyubin Nov 5, 2019
9332ad3
Merge branch 'latest' of github.com:bbc/psammead into change-brand-he…
OlgaLyubin Nov 5, 2019
5ba0c4d
Add PR number
OlgaLyubin Nov 5, 2019
aac4dbe
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 5, 2019
a8f0997
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 5, 2019
4768c09
Bump brand version
OlgaLyubin Nov 5, 2019
3152791
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 6, 2019
a6fc1c0
Merge branch 'change-brand-height' of github.com:bbc/psammead into ch…
OlgaLyubin Nov 6, 2019
b81b313
Change styling for Brand Component
OlgaLyubin Nov 6, 2019
2fb7140
Updated snapshots
OlgaLyubin Nov 6, 2019
511664b
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 6, 2019
9587108
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 7, 2019
697a22e
Bump up version
OlgaLyubin Nov 7, 2019
0270c1d
Change styling for nav with script link
OlgaLyubin Nov 7, 2019
0af2909
Update snapshots
OlgaLyubin Nov 7, 2019
cece402
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 7, 2019
d8508a1
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 7, 2019
51cbba8
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 7, 2019
25d4ea5
Refactoring
OlgaLyubin Nov 8, 2019
6516cdd
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 11, 2019
7d280fe
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 11, 2019
d6dbc3b
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 11, 2019
2aed79b
Merge branch 'latest' into change-brand-height
OlgaLyubin Nov 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/psammead-brand/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
| ------- | ----------- |
| 5.1.0-alpha.5 | [PR#2569](https://github.com/bbc/psammead/pull/2569) Reduce height of Brand Component for all breakpoints |
| 5.1.0-alpha.4 | [PR#2564](https://github.com/bbc/psammead/pull/2564) Add skip to content link |
| 5.1.0-alpha.3 | [PR#2539](https://github.com/bbc/psammead/pull/2539) Fix overlapping between `ScriptLink` and `Brand` |
| 5.1.0-alpha.2 | [PR#2519](https://github.com/bbc/psammead/pull/2519) Talos - Bump Dependencies - @bbc/psammead-styles |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-brand/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/psammead-brand/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-brand",
"version": "5.1.0-alpha.4",
"version": "5.1.0-alpha.5",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`Brand should render correctly with link not provided 1`] = `

.c0 {
background-color: #B80000;
min-height: 3.5rem;
min-height: 2.5rem;
width: 100%;
padding: 0 0.5rem;
}
Expand All @@ -45,8 +45,8 @@ exports[`Brand should render correctly with link not provided 1`] = `
box-sizing: content-box;
color: #FFFFFF;
fill: currentColor;
padding-top: 1rem;
padding-bottom: 0.75rem;
padding-top: 0.625rem;
padding-bottom: 0.375rem;
height: 1.5rem;
width: 100%;
max-width: 17.5rem;
Expand All @@ -69,21 +69,22 @@ exports[`Brand should render correctly with link not provided 1`] = `

@media (min-width:25rem) {
.c0 {
min-height: 5rem;
min-height: 3.25rem;
padding: 0 1rem;
}
}

@media (max-width:14.9375rem) {
.c0 {
min-height: 6.5rem;
@media (min-width:25rem) {
.c2 {
padding-top: 1rem;
padding-bottom: 0.75rem;
}
}

@media (min-width:25rem) {
@media (min-width:37.5rem) {
.c2 {
padding-top: 1.75rem;
padding-bottom: 1.5rem;
padding-top: 1.25rem;
padding-bottom: 1rem;
}
}

Expand Down Expand Up @@ -167,7 +168,7 @@ exports[`Brand should render correctly with link provided 1`] = `

.c0 {
background-color: #B80000;
min-height: 3.5rem;
min-height: 2.5rem;
width: 100%;
padding: 0 0.5rem;
}
Expand All @@ -183,8 +184,8 @@ exports[`Brand should render correctly with link provided 1`] = `
box-sizing: content-box;
color: #FFFFFF;
fill: currentColor;
padding-top: 1rem;
padding-bottom: 0.75rem;
padding-top: 0.625rem;
padding-bottom: 0.375rem;
height: 1.5rem;
width: 100%;
max-width: 17.5rem;
Expand All @@ -207,17 +208,11 @@ exports[`Brand should render correctly with link provided 1`] = `

@media (min-width:25rem) {
.c0 {
min-height: 5rem;
min-height: 3.25rem;
padding: 0 1rem;
}
}

@media (max-width:14.9375rem) {
.c0 {
min-height: 6.5rem;
}
}

@media (max-width:14.9375rem) {
.c3 {
display: block;
Expand All @@ -226,8 +221,15 @@ exports[`Brand should render correctly with link provided 1`] = `

@media (min-width:25rem) {
.c4 {
padding-top: 1.75rem;
padding-bottom: 1.5rem;
padding-top: 1rem;
padding-bottom: 0.75rem;
}
}

@media (min-width:37.5rem) {
.c4 {
padding-top: 1.25rem;
padding-bottom: 1rem;
}
}

Expand Down Expand Up @@ -316,7 +318,7 @@ exports[`Brand should render correctly with no service Localised Name 1`] = `

.c0 {
background-color: #B80000;
min-height: 3.5rem;
min-height: 2.5rem;
width: 100%;
padding: 0 0.5rem;
}
Expand All @@ -325,8 +327,8 @@ exports[`Brand should render correctly with no service Localised Name 1`] = `
box-sizing: content-box;
color: #FFFFFF;
fill: currentColor;
padding-top: 1rem;
padding-bottom: 0.75rem;
padding-top: 0.625rem;
padding-bottom: 0.375rem;
height: 1.5rem;
width: 100%;
max-width: 17.5rem;
Expand All @@ -349,21 +351,22 @@ exports[`Brand should render correctly with no service Localised Name 1`] = `

@media (min-width:25rem) {
.c0 {
min-height: 5rem;
min-height: 3.25rem;
padding: 0 1rem;
}
}

@media (max-width:14.9375rem) {
.c0 {
min-height: 6.5rem;
@media (min-width:25rem) {
.c2 {
padding-top: 1rem;
padding-bottom: 0.75rem;
}
}

@media (min-width:25rem) {
@media (min-width:37.5rem) {
.c2 {
padding-top: 1.75rem;
padding-bottom: 1.5rem;
padding-top: 1.25rem;
padding-bottom: 1rem;
}
}

Expand Down Expand Up @@ -440,7 +443,7 @@ exports[`Brand should render correctly with transparent borders 1`] = `

.c0 {
background-color: #B80000;
min-height: 3.5rem;
min-height: 2.5rem;
width: 100%;
padding: 0 0.5rem;
border-top: 0.0625rem solid transparent;
Expand All @@ -451,8 +454,8 @@ exports[`Brand should render correctly with transparent borders 1`] = `
box-sizing: content-box;
color: #FFFFFF;
fill: currentColor;
padding-top: 1rem;
padding-bottom: 0.75rem;
padding-top: 0.625rem;
padding-bottom: 0.375rem;
height: 1.5rem;
width: 100%;
max-width: 17.5rem;
Expand All @@ -475,21 +478,22 @@ exports[`Brand should render correctly with transparent borders 1`] = `

@media (min-width:25rem) {
.c0 {
min-height: 5rem;
min-height: 3.25rem;
padding: 0 1rem;
}
}

@media (max-width:14.9375rem) {
.c0 {
min-height: 6.5rem;
@media (min-width:25rem) {
.c2 {
padding-top: 1rem;
padding-bottom: 0.75rem;
}
}

@media (min-width:25rem) {
@media (min-width:37.5rem) {
.c2 {
padding-top: 1.75rem;
padding-bottom: 1.5rem;
padding-top: 1.25rem;
padding-bottom: 1rem;
}
}

Expand Down
34 changes: 24 additions & 10 deletions packages/components/psammead-brand/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@ import styled from 'styled-components';
import { string, number, node, shape, bool } from 'prop-types';
import VisuallyHiddenText from '@bbc/psammead-visually-hidden-text';
import {
GEL_GROUP_0_SCREEN_WIDTH_MAX,
GEL_GROUP_2_SCREEN_WIDTH_MIN,
GEL_GROUP_3_SCREEN_WIDTH_MIN,
GEL_GROUP_5_SCREEN_WIDTH_MIN,
GEL_GROUP_0_SCREEN_WIDTH_MAX,
} from '@bbc/gel-foundations/breakpoints';
import {
GEL_SPACING_HLF,
GEL_SPACING,
GEL_SPACING_DBL,
GEL_SPACING_TRPL,
} from '@bbc/gel-foundations/spacings';
import { getPica } from '@bbc/gel-foundations/typography';
import { getSansRegular } from '@bbc/psammead-styles/font-styles';

const SVG_TOP_OFFSET_ABOVE_400PX = '1.75rem'; // 28px
const SVG_BOTTOM_OFFSET_BELOW_400PX = '0.75rem'; // 12px
const PADDING_AROUND_SVG_ABOVE_400PX = 56;
const PADDING_AROUND_SVG_BELOW_400PX = 32;
const SVG_TOP_OFFSET_BELOW_400PX = '0.625rem'; // 10px
const SVG_BOTTOM_OFFSET_BELOW_400PX = '0.375rem'; // 6px
const SVG_BOTTOM_OFFSET_ABOVE_400PX = '0.75rem'; // 12px
const SVG_BOTTOM_OFFSET_ABOVE_600PX = '1.25rem'; // 20px
const SCRIPT_LINK_OFFSET_BELOW_240PX = 52;
const PADDING_AROUND_SVG_BELOW_400PX = 16;
const PADDING_AROUND_SVG_ABOVE_400PX = 28;

const conditionallyRenderHeight = (svgHeight, padding) =>
svgHeight ? `min-height: ${(svgHeight + padding) / 16}rem;` : '';
Expand Down Expand Up @@ -54,7 +57,12 @@ const Banner = styled.div`
}

@media (max-width: ${GEL_GROUP_0_SCREEN_WIDTH_MAX}) {
min-height: ${({ svgHeight }) => svgHeight / 16 + 5}rem;
${({ scriptLink, svgHeight }) =>
scriptLink &&
`min-height: ${(svgHeight +
PADDING_AROUND_SVG_BELOW_400PX +
SCRIPT_LINK_OFFSET_BELOW_240PX) /
16}rem;`}
}

border-top: ${({ borderTop }) => borderTop && TRANSPARENT_BORDER};
Expand All @@ -81,15 +89,20 @@ const BrandSvg = styled.svg`
box-sizing: content-box;
color: ${props => props.logoColour};
fill: currentColor;
padding-top: ${GEL_SPACING_DBL};
padding-top: ${SVG_TOP_OFFSET_BELOW_400PX};
padding-bottom: ${SVG_BOTTOM_OFFSET_BELOW_400PX};
height: ${props => props.height / 16}rem;

${({ maxWidth, minWidth }) => brandWidth(minWidth, maxWidth)}

@media (min-width: ${GEL_GROUP_2_SCREEN_WIDTH_MIN}) {
padding-top: ${SVG_TOP_OFFSET_ABOVE_400PX};
padding-bottom: ${GEL_SPACING_TRPL};
padding-top: ${GEL_SPACING_DBL};
padding-bottom: ${SVG_BOTTOM_OFFSET_ABOVE_400PX};
}

@media (min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) {
padding-top: ${SVG_BOTTOM_OFFSET_ABOVE_600PX};
padding-bottom: ${GEL_SPACING_DBL};
}

@media screen and (-ms-high-contrast: active), print {
Expand Down Expand Up @@ -236,6 +249,7 @@ const Brand = props => {
borderBottom={borderBottom}
backgroundColour={backgroundColour}
logoColour={logoColour}
scriptLink={scriptLink}
{...rest}
>
<SvgWrapper>
Expand Down
3 changes: 2 additions & 1 deletion packages/components/psammead-script-link/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 1.0.0-alpha.8 | [PR#2569](https://github.com/bbc/psammead/pull/2569) Reduce height of Script link for 600px+ breakpoints |
| 1.0.0-alpha.7 | [PR#2519](https://github.com/bbc/psammead/pull/2519) Talos - Bump Dependencies - @bbc/psammead-styles |
| 1.0.0-alpha.6 | [PR#2488](https://github.com/bbc/psammead/pull/2488) Talos - Bump Dependencies - @bbc/gel-foundations |
| 1.0.0-alpha.5 | [PR#2477](https://github.com/bbc/psammead/pull/2477) Talos - Bump Dependencies - @bbc/psammead-styles |
| 1.0.0-alpha.4 | [PR#2440](https://github.com/bbc/psammead/pull/2440) Talos - Bump Dependencies - @bbc/psammead-styles |
| 1.0.0-alpha.3 | [PR#2404](https://github.com/bbc/psammead/pull/2404) replace inputProvider and dirDecorator with withServicesInput |
| 1.0.0-alpha.3 | [PR#2404](https://github.com/bbc/psammead/pull/2404) Replace inputProvider and dirDecorator with withServicesInput |
| 1.0.0-alpha.2 | [PR#2362](https://github.com/bbc/psammead/pull/2362) Update breakpoints |
| 1.0.0-alpha.1 | [PR#2294](https://github.com/bbc/psammead/pull/2294) Initial creation of package. |
2 changes: 1 addition & 1 deletion packages/components/psammead-script-link/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/psammead-script-link/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-script-link",
"version": "1.0.0-alpha.7",
"version": "1.0.0-alpha.8",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ exports[`ScriptLink should render correctly 1`] = `
}
}

@media (min-width:37.5rem) {
.c0 {
height: 2.25rem;
line-height: 2.25rem;
padding: 0 0.625rem;
}
}

<a
class="c0"
href="https://www.bbc.co.uk/news"
Expand Down
8 changes: 7 additions & 1 deletion packages/components/psammead-script-link/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import styled from 'styled-components';
import { getPica } from '@bbc/gel-foundations/typography';
import {
GEL_GROUP_2_SCREEN_WIDTH_MIN,
GEL_GROUP_1_SCREEN_WIDTH_MAX,
GEL_GROUP_2_SCREEN_WIDTH_MIN,
GEL_GROUP_3_SCREEN_WIDTH_MIN,
} from '@bbc/gel-foundations/breakpoints';
import { getSansRegular } from '@bbc/psammead-styles/font-styles';
import { C_WHITE, C_EBON } from '@bbc/psammead-styles/colours';
Expand Down Expand Up @@ -43,6 +44,11 @@ const StyledLink = styled.a`
height: 2.5rem;
padding: 0 0.75rem;
}
@media (min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) {
height: 2.25rem;
line-height: 2.25rem;
padding: 0 0.625rem;
}
`;

const ScriptLink = ({ children, script, service, href, variant }) => (
Expand Down