@bbc/psammead-radio-schedule

中文文档
5.1.35发布于 2021/06/21Apache-2.0ESM + CJS近 30 天下载 3049

Component package for radio schedule components

此软件包已被标记为弃用

This package is no longer maintained.

原始使用文档
文档目录20 节
  1. Description
  2. Exports
  3. Installation
  4. Components (WIP)
  5. RadioSchedule
  6. Props
  7. Usage
  8. ProgramCard
  9. Props
  10. Usage
  11. StartTime
  12. Props
  13. Usage
  14. When to use this component
  15. When not to use this component
  16. Accessibility notes
  17. Roadmap
  18. Contributing
  19. Code of Conduct
  20. License

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.

版本与发布记录

@bbc/psammead-radio-schedule 共发布 128 个版本,首次发布于 2020/01/30;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.1.35latest2021/06/215 年前
5.1.342021/05/275 年前
5.1.332021/05/265 年前
5.1.322021/03/175 年前
5.1.312021/03/165 年前
5.1.302021/03/105 年前

其他发布通道:alpha → 4.0.0-alpha.0。

关于 @bbc/psammead-radio-schedule 的常见问题

@bbc/psammead-radio-schedule 是什么?

Component package for radio schedule components注意:该包已被作者标记为弃用——This package is no longer maintained.

如何安装 @bbc/psammead-radio-schedule?

在项目目录运行 npm install @bbc/psammead-radio-schedule,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=16.9.0)、@emotion/styled(^11.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bbc/psammead-radio-schedule 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bbc__psammead-radio-schedule 是否存在。

@bbc/psammead-radio-schedule 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bbc/psammead-radio-schedule 可以商用吗?

@bbc/psammead-radio-schedule 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bbc/psammead-radio-schedule 的下载量有多少?

根据 npm 官方下载统计,@bbc/psammead-radio-schedule 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,049 次,日均约 102 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bbc/psammead-radio-schedule 还在维护吗?

最新版本 5.1.35 发布于 2021/06/21(5 年前);至今共发布 128 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/01/30。作者已将其标记为弃用,新项目建议寻找替代方案。