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

Commit

Permalink
Merge branch 'latest' into caption-paragraph-padding
Browse files Browse the repository at this point in the history
  • Loading branch information
oluoluoxenfree authored May 7, 2019
2 parents ba121f1 + 323ae44 commit 2fe5313
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/components/psammead-timestamp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 0.3.0 | [PR#494](https://github.com/bbc/psammead/pull/494) Make script a required prop. |
| 0.2.0 | [PR#461](https://github.com/bbc/psammead/pull/461) Make timestamp typography styling agnostic |
| 0.1.0 | [PR#440](https://github.com/bbc/psammead/pull/440) Create initial package with Timestamp component pulled in from [Simorgh](https://github.com/BBC-News/simorgh). |
| 0.1.0 | [PR#440](https://github.com/bbc/psammead/pull/440) Create initial package with Timestamp component pulled in from [Simorgh](https://github.com/BBC-News/simorgh). |
4 changes: 2 additions & 2 deletions packages/components/psammead-timestamp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When a date or time is to be displayed inline inside a paragraph.
|------------|--------|----------|---------|--------------------------|
| `datetime` | string ([supported formats](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#Valid_datetime_Values)) | Yes | N/A | `2006-09-24T05:00-07:00` |
| `typographyFunc` | function | No | getBrevier | `function getPica(script){ return 'font-size: 28'; }` |
| `script` | object | No | latin | { canon: { groupA: { fontSize: '28', lineHeight: '32',}, groupB: { fontSize: '32', lineHeight: '36', }, groupD: { fontSize: '44', lineHeight: '48', }, }, trafalgar: { groupA: { fontSize: '20', lineHeight: '24', }, groupB: { fontSize: '24', lineHeight: '28', }, groupD: { fontSize: '32', lineHeight: '36', }, }, }|
| `script` | object | Yes | N/A | { canon: { groupA: { fontSize: '28', lineHeight: '32',}, groupB: { fontSize: '32', lineHeight: '36', }, groupD: { fontSize: '44', lineHeight: '48', }, }, trafalgar: { groupA: { fontSize: '20', lineHeight: '24', }, groupB: { fontSize: '24', lineHeight: '28', }, groupD: { fontSize: '32', lineHeight: '36', }, }, }|

## Usage

Expand All @@ -35,7 +35,7 @@ const WrappingContainer = () => (
<Timestamp
datetime="2019-03-01T14:00+00:00"
typographyFunc={getPica}
script={script}
script={latin}
>
Friday 1 March 2019
</Timestamp>
Expand Down
4 changes: 1 addition & 3 deletions packages/components/psammead-timestamp/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '@bbc/gel-foundations/spacings';
import { GEL_FF_REITH_SANS, getBrevier } from '@bbc/gel-foundations/typography';
import { scriptPropType } from '@bbc/gel-foundations/prop-types';
import { latin } from '@bbc/gel-foundations/scripts';
import { C_CLOUD_DARK } from '@bbc/psammead-styles/colours';

const StyledTimestamp = styled.time`
Expand All @@ -32,15 +31,14 @@ const Timestamp = ({ children, datetime, typographyFunc, script }) => (
);

Timestamp.defaultProps = {
script: latin,
typographyFunc: getBrevier,
};

Timestamp.propTypes = {
children: node.isRequired,
datetime: string.isRequired,
typographyFunc: func,
script: shape(scriptPropType),
script: shape(scriptPropType).isRequired,
};

export default Timestamp;
4 changes: 3 additions & 1 deletion packages/components/psammead-timestamp/src/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Timestamp from '.';
describe('Timestamp', () => {
shouldMatchSnapshot(
'should render Timestamp correctly',
<Timestamp datetime="1530947227000">7 July 2018</Timestamp>,
<Timestamp datetime="1530947227000" script={latin}>
7 July 2018
</Timestamp>,
);

shouldMatchSnapshot(
Expand Down

0 comments on commit 2fe5313

Please sign in to comment.