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

Commit

Permalink
Merge pull request #707 from bbc/new-inline-link-styling
Browse files Browse the repository at this point in the history
New inline link styling
  • Loading branch information
Phil Lee authored Jul 2, 2019
2 parents a1df445 + 30cfc26 commit 1ff3552
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/components/psammead-inline-link/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<! -- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 1.1.0 | [PR#719](https://github.com/bbc/psammead/pull/719) Updates the link styling to new UX designs |
| 1.0.1 | [PR#713](https://github.com/bbc/psammead/pull/713) Update `styled-components` to 4.3.2 |
| 1.0.0 | [PR#679](https://github.com/bbc/psammead/pull/679) Bump version number |
| 0.3.8 | [PR#498](https://github.com/bbc/psammead/pull/498) Update stories to use new input provider |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-inline-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This component can be used at any point on a page.
Since this is just a `<a>` tag with associated styles, when you use this component, it has the same semantic meaning as a regular anchor element.
The font and background-color choices for each hover/focused/visited/default states meet WCAG AA colour contrast guidelines.
The font and background-color choices for each hover/focused/visited/default states meet WCAG AA colour contrast guidelines. Also the border width increases on hover and focus which acts as a visible change that is not colour dependent for high-contrast modes, which often override colours/styles.
## Contributing
Expand Down
8 changes: 4 additions & 4 deletions packages/components/psammead-inline-link/package-lock.json

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

4 changes: 2 additions & 2 deletions packages/components/psammead-inline-link/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-inline-link",
"version": "1.0.1",
"version": "1.1.0",
"description": "React styled component for an Inline Link",
"main": "dist/index.js",
"repository": {
Expand All @@ -23,7 +23,7 @@
},
"homepage": "https://github.com/bbc/psammead/blob/latest/packages/components/psammead-inline-link/README.md",
"dependencies": {
"@bbc/psammead-styles": "^0.2.1"
"@bbc/psammead-styles": "^1.0.0"
},
"devDependencies": {
"@bbc/psammead-storybook-helpers": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`InlineLink should render correctly 1`] = `
.c0 {
color: #222222;
color: #B80000;
border-bottom: 1px solid #B80000;
-webkit-text-decoration: none;
text-decoration: none;
Expand All @@ -13,14 +13,14 @@ exports[`InlineLink should render correctly 1`] = `
border-bottom: 1px solid #757575;
}
.c0:focus {
color: #B80000;
border-bottom: 2px solid #B80000;
}
.c0:focus,
.c0:hover {
color: #B80000;
background-color: #B80000;
border-bottom: 2px solid #B80000;
color: #FFFFFF;
margin: 0 -2px;
padding: 0 2px;
white-space: pre-wrap;
}
<a
Expand Down
16 changes: 8 additions & 8 deletions packages/components/psammead-inline-link/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styled from 'styled-components';
import { C_EBON, C_POSTBOX, C_CLOUD_DARK } from '@bbc/psammead-styles/colours';
import { C_POSTBOX, C_CLOUD_DARK, C_WHITE } from '@bbc/psammead-styles/colours';

const InlineLink = styled.a`
color: ${C_EBON};
color: ${C_POSTBOX};
border-bottom: 1px solid ${C_POSTBOX};
text-decoration: none;
Expand All @@ -11,14 +11,14 @@ const InlineLink = styled.a`
border-bottom: 1px solid ${C_CLOUD_DARK};
}
&:focus {
color: ${C_POSTBOX};
border-bottom: 2px solid ${C_POSTBOX};
}
&:focus,
&:hover {
color: ${C_POSTBOX};
background-color: ${C_POSTBOX};
border-bottom: 2px solid ${C_POSTBOX};
color: ${C_WHITE};
margin: 0 -2px;
padding: 0 2px;
white-space: pre-wrap;
}
`;

Expand Down
13 changes: 11 additions & 2 deletions packages/components/psammead-inline-link/src/index.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { Fragment } from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import { inputProvider } from '@bbc/psammead-storybook-helpers';
Expand All @@ -10,7 +10,16 @@ storiesOf('Components|InlineLink', module)
.add(
'default',
inputProvider([{ name: 'Link text' }], ([linkText]) => (
<InlineLink href="https://www.bbc.com/news">{linkText}</InlineLink>
<Fragment>
<InlineLink href="https://www.bbc.com/news">{linkText}</InlineLink>
<br />
<br />
Please note this component does not have its own typography styling
(font-size and line-height) as it is expected to be used within another
component such as paragraph or caption. For a more realistic storybook
example of this component see the Paragraph and Caption stories - this
should be removed in https://github.com/bbc/psammead/issues/733
</Fragment>
)),
{ notes, knobs: { escapeHTML: false } },
);

0 comments on commit 1ff3552

Please sign in to comment.