5.1.35 • Published 3 years ago

@bbc/psammead-radio-schedule v5.1.35

Weekly downloads
1,314
License
Apache-2.0
Repository
github
Last release
3 years ago

psammead-radio-schedule - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The RadioSchedule component is designed to display radio schedule programs in their different states. Currently, the component comprises of a ProgramCard which is comprised of a link to the radio-schedule, a state label, brand and episode titles, a summary, and a duration.

Exports

/startTime - Adds a starting time of the program with a clock icon, timestamp and horizontal line.

Installation

npm install @bbc/psammead-radio-schedule --save

Components (WIP)

RadioSchedule

Props

ArgumentTypeRequiredDefaultExample
schedulesarrayyesN/A[{ id: '1', state: 'live', stateLabel: 'Live', startTime: '1566914061212', link: 'www.bbc.co.uk', brandTitle: 'This is a brand title', episodeTitle: 'This is an episode title', summary: 'This is a summary', duration: '45:00'}]
servicestringyesN/A'news'
scriptobjectyesN/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', }, }, }
localestringnoN/A'en-gb'
timezonestringnoN/A'Europe/London'
durationLabelstringyesN/A'Duration %duration%'
liveLabelstringyesN/A'LIVE'
nextLabelstringyesN/A'NEXT'
dirstringno"ltr""rtl"
linkComponentelementType | stringno"a"ReactRouterLink
linkComponentAttrstringno"href""to"

Usage

This component displays radio schedule program-card and start-time component for all schedules passed in.

import React from 'react';
import { latin } from '@bbc/gel-foundations/scripts';
import RadioSchedule from '@bbc/psammead-radio-schedule';

const schedules = [
  {
    id: 1,
    state: 'live',
    startTime: 1566914061212,
    link: 'www.bbc.co.uk',
    brandTitle: 'This is a brand title',
    summary: 'This is a summary',
    duration: '45:00',
  },
];

<RadioSchedule
  schedules={schedules}
  locale="en-gb"
  timezone="Europe/London"
  script={latin}
  service="news"
  dir="ltr"
  liveLabel="LIVE"
  nextLabel="NEXT"
  durationLabel="Duration %duration%"
/>;

While the default link component is an a tag, it can be replaced with a react-router-dom Link component

import React from 'react';
import { Link } from 'react-router-dom';
import { latin } from '@bbc/gel-foundations/scripts';
import RadioSchedule from '@bbc/psammead-radio-schedule';

const schedules = [
  {
    id: 1,
    state: 'test',
    startTime: 1566914061212,
    link: 'www.bbc.co.uk',
    brandTitle: 'This is another brand title',
    summary: 'This is a longer summary',
    duration: '30:00',
  },
];

<RadioSchedule
  schedules={schedules}
  locale="en-gb"
  timezone="Europe/London"
  script={latin}
  service="news"
  dir="ltr"
  liveLabel="LIVE"
  nextLabel="NEXT"
  durationLabel="Duration %duration%"
  linkComponent={Link}
  linkComponentAttr="to"
/>;

ProgramCard

Props

ArgumentTypeRequiredDefaultExample
brandTitlestringyesN/A'This is a brand title'
summarystringnonull'This is a summary'
durationstringyesN/A'PT30M'
durationLabelstringyesN/A'Duration %duration%'
statestringyesN/A'live'
liveLabelstringyesN/A'LIVE'
nextLabelstringyesN/A'NEXT'
linkstringyesN/A'https://bbc.com/arabic/articles/c1er5mjnznzo'
startTimenumberyesN/A1566914061212
servicestringyesN/A'news'
scriptobjectyesN/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', }, }, }
dirstringno"ltr""rtl"
timezonestringno'GMT''Europe/London'
localestringno'en-gb''fa'
linkComponentelementType | stringno"a"ReactRouterLink
linkComponentAttrstringno"href""to"

Usage

This component displays a single link as program card with a brand title, an episode title, a summary and a duration. It also allows for an override of the link component in a manner similar to the RadioSchedule component above.

import React from 'react';
import { latin } from '@bbc/gel-foundations/scripts';
import ProgramCard from '@bbc/psammead-radio-schedule/ProgramCard';

<ProgramCard
  service="news"
  script={latin}
  dir="ltr"
  startTime="13:00"
  brandTitle="This is a brand title"
  summary="Could a computer ever create better art than a human?"
  duration="PT30M"
  durationLabel="Duration %duration%"
  state="live"
  liveLabel="LIVE"
  nextLabel="NEXT"
  link="https://bbc.com/arabic/articles/c1er5mjnznzo"
  timezone="Europe/London"
/>;

StartTime

Props

ArgumentTypeRequiredDefaultExample
timestampnumberyesN/A1530947227000
timezonestringno'Europe/London''Europe/Vienna'
localestringno'en-gb''fa'
scriptobjectyesN/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', }, }, }
servicestringyesN/Anews
dirstringno'ltr''rtl'

Usage

import React from 'react';
import StartTime from '@bbc/psammead-radio-schedule/startTime';
import { latin } from '@bbc/gel-foundations/scripts';

<StartTime
  script={latin}
  service="news"
  timestamp={1566914061212}
  timezone="Europe/London"
  locale="en-gb"
  dir="ltr"
/>;

When to use this component

This component is to be used initially on the front pages, and media pages.

When not to use this component

Accessibility notes

Roadmap

Contributing

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead repository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.

5.1.35

3 years ago

5.1.34

3 years ago

5.1.33

3 years ago

5.1.32

3 years ago

5.1.31

3 years ago

5.1.30

3 years ago

5.1.29

3 years ago

5.1.28

3 years ago

5.1.27

3 years ago

5.1.26

3 years ago

5.1.25

3 years ago

5.1.24

3 years ago

5.1.23

3 years ago

5.1.22

3 years ago

5.1.21

3 years ago

5.1.20

3 years ago

5.1.19

3 years ago

5.1.18

3 years ago

5.1.17

3 years ago

5.1.16

3 years ago

5.1.15

3 years ago

5.1.14

3 years ago

5.1.13

3 years ago

5.1.12

3 years ago

5.1.9

3 years ago

5.1.8

3 years ago

5.1.11

3 years ago

5.1.10

3 years ago

5.1.7

3 years ago

5.1.6

3 years ago

5.1.5

3 years ago

5.1.4

3 years ago

5.1.3

3 years ago

5.1.2

3 years ago

5.1.1

3 years ago

5.1.0

3 years ago

5.0.16

3 years ago

5.0.15

3 years ago

5.0.14

3 years ago

5.0.13

3 years ago

5.0.11

3 years ago

5.0.12

3 years ago

5.0.9

3 years ago

5.0.10

3 years ago

5.0.8

3 years ago

5.0.7

3 years ago

5.0.6

3 years ago

5.0.5

4 years ago

5.0.4

4 years ago

5.0.3

4 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.1

4 years ago

4.0.2

4 years ago

4.0.0-alpha.0

4 years ago

3.0.26

4 years ago

3.0.24

4 years ago

3.0.25

4 years ago

3.0.23

4 years ago

3.0.22

4 years ago

3.0.21

4 years ago

3.0.20

4 years ago

3.0.19

4 years ago

3.0.18

4 years ago

3.0.16

4 years ago

3.0.17

4 years ago

3.0.14

4 years ago

3.0.15

4 years ago

3.0.13

4 years ago

3.0.12

4 years ago

3.0.11

4 years ago

3.0.10

4 years ago

3.0.8

4 years ago

3.0.9

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.0-alpha.32

4 years ago

0.1.0-alpha.33

4 years ago

0.1.0-alpha.31

4 years ago

0.1.0-alpha.30

4 years ago

0.1.0-alpha.29

4 years ago

0.1.0-alpha.27

4 years ago

0.1.0-alpha.28

4 years ago

0.1.0-alpha.26

4 years ago

0.1.0-alpha.23

4 years ago

0.1.0-alpha.25

4 years ago

0.1.0-alpha.24

4 years ago

0.1.0-alpha.22

4 years ago

0.1.0-alpha.21

4 years ago

0.1.0-alpha.20

4 years ago

0.1.0-alpha.18

4 years ago

0.1.0-alpha.19

4 years ago

0.1.0-alpha.17

4 years ago

0.1.0-alpha.16

4 years ago

0.1.0-alpha.15

4 years ago

0.1.0-alpha.14

4 years ago

0.1.0-alpha.13

4 years ago

0.1.0-alpha.12

4 years ago

0.1.0-alpha.9

4 years ago

0.1.0-alpha.8

4 years ago

0.1.0-alpha.7

4 years ago

0.1.0-alpha.6

4 years ago

0.1.0-alpha.5

4 years ago

0.1.0-alpha.4

4 years ago

0.1.0-alpha.3

4 years ago

0.1.0-alpha.2

4 years ago