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

Add pseudo element to ScriptLink. #2750

Merged
merged 9 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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-script-link/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 1.0.0-alpha.12 | [PR#2750](https://github.com/bbc/psammead/pull/2750) Add ScriptLink touch area styles |
| 1.0.0-alpha.11 | [PR#2701](https://github.com/bbc/psammead/pull/2701) Talos - Bump Dependencies - @bbc/psammead-styles |
| 1.0.0-alpha.10 | [PR#2697](https://github.com/bbc/psammead/pull/2697) Talos - Bump Dependencies - @bbc/psammead-styles |
| 1.0.0-alpha.9 | [PR#2685](https://github.com/bbc/psammead/pull/2685) Use border on hover and focus |
Expand Down
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.11",
"version": "1.0.0-alpha.12",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`ScriptLink should render correctly 1`] = `
height: 3rem;
}

.c0::after {
.c0::before {
content: '';
position: absolute;
top: 0;
Expand All @@ -26,8 +26,8 @@ exports[`ScriptLink should render correctly 1`] = `
border: 0.0625rem solid #FFFFFF;
}

.c0:hover::after,
.c0:focus::after {
.c0:hover::before,
.c0:focus::before {
border: 0.25rem solid #FFFFFF;
}

Expand All @@ -45,12 +45,6 @@ exports[`ScriptLink should render correctly 1`] = `
}
}

@media (min-width:25rem) {
.c0 {
line-height: 3rem;
}
}

@media (max-width:24.9375rem) {
.c0 {
line-height: 2.5rem;
Expand All @@ -59,12 +53,42 @@ exports[`ScriptLink should render correctly 1`] = `
}
}

@media (min-width:25rem) {
.c0 {
line-height: 3rem;
}

.c0::after {
content: '';
position: absolute;
top: -0.25rem;
left: -0.25rem;
right: 0;
bottom: 0;
height: 2.75rem;
width: 2.75rem;
margin: 0 0.25rem;
}
}

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

.c0::after {
content: '';
position: absolute;
top: -0.25rem;
left: -0.25rem;
right: 0;
bottom: 0;
height: 2.75rem;
width: 2.75rem;
margin: 0 0.25rem;
}
}

<a
Expand Down
29 changes: 23 additions & 6 deletions packages/components/psammead-script-link/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ import { C_WHITE } from '@bbc/psammead-styles/colours';
import { string, shape, node } from 'prop-types';
import { scriptPropType } from '@bbc/gel-foundations/prop-types';

const touchAreaStyles = `
&::after {
content: '';
position: absolute;
top: -0.25rem;
left: -0.25rem;
right: 0;
bottom: 0;
height: 2.75rem;
width: 2.75rem;
margin: 0 0.25rem;
}`;

const StyledLink = styled.a`
${({ script }) => script && getPica(script)}
${({ service }) => service && getSansRegular(service)}
Expand All @@ -21,7 +34,7 @@ const StyledLink = styled.a`
padding: 0 1rem;
height: 3rem;

&::after {
&::before {
content: '';
position: absolute;
top: 0;
Expand All @@ -31,23 +44,27 @@ const StyledLink = styled.a`
border: 0.0625rem solid ${C_WHITE};
}

&:hover::after,
&:focus::after {
&:hover::before,
&:focus::before {
border: 0.25rem solid ${C_WHITE};
}

@media (min-width: ${GEL_GROUP_2_SCREEN_WIDTH_MIN}) {
line-height: 3rem;
}
@media (max-width: ${GEL_GROUP_1_SCREEN_WIDTH_MAX}) {
line-height: 2.5rem;
height: 2.5rem;
padding: 0 0.75rem;
}
@media (min-width: ${GEL_GROUP_2_SCREEN_WIDTH_MIN}) {
line-height: 3rem;

${touchAreaStyles}
}
@media (min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) {
height: 2.25rem;
line-height: 2.25rem;
padding: 0 0.625rem;

${touchAreaStyles}
}
`;

Expand Down