@bbc/psammead-story-promo-list

中文文档
6.0.34发布于 2022/03/30Apache-2.0ESM + CJS近 30 天下载 4519

List of story promos

原始使用文档
文档目录9 节
  1. Description
  2. Installation
  3. Props
  4. Usage
  5. When to use this component
  6. Accessibility notes
  7. Contributing
  8. Code of Conduct
  9. License

psammead-story-promo-list - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The @bbc/psammead-story-promo-list package is a set of three components, StoryPromoUl, StoryPromoLi and StoryPromoLiBase. They use ul and li HTML elements respectively. The StoryPromoLi and StoryPromoLiBase components are both li elements and can be used interchangeably as they have similar props the only difference is that the StoryPromoLiBase ships with no padding presets thereby making it much more configurable to any set of padding/margin rules set on child elements.

Installation

npm install @bbc/psammead-story-promo-list

Props

ArgumentTypeRequiredDefaultExample
childrennodeyesN/A<StoryPromoLi><StoryPromo image={Image} info={Info} /></StoryPromoLi>
borderboolnotruefalse

Usage

Commonly used alongside psammead-story-promo.

import React, { Fragment } from 'react';
import StoryPromo, { Headline, Summary } from '@bbc/psammead-story-promo';
import { StoryPromoLi, StoryPromoUl } from '@bbc/psammead-story-promo-list';
import { latin } from '@bbc/gel-foundations/scripts';

const Image = (
  <img src="https://foobar.com/image.jpg" />
);

const Info = (
  <Fragment>
    <Headline script={latin}>
      <Link href="https://www.bbc.co.uk/news">The headline of the promo</Link>
   </Headline>
    <Summary script={latin}>The summary of the promo</Summary>
    <time>12 March 2019</time>
  </Fragment>
);

<StoryPromo
  image={Image}
  info={Info}
/>

<StoryPromoUl>
  <StoryPromoLi>
    <StoryPromo image={Image} info={Info} />;
  </StoryPromoLi>
  <StoryPromoLi>
    <StoryPromo image={Image} info={Info} />;
  </StoryPromoLi>
</StoryPromoUl>

When to use this component

This component is designed to be used with story promos on 'index' pages.

Accessibility notes

We have added the role list and listitem to the corresponding list items due to a VoiceOver bug to reinstate the list semantics.

We haven't yet thoroughly looked at cross device browser AT testing yet, this is in-progress. We will update with a11y notes when carrying out a proper release.

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 respository.

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-story-promo-list 共发布 109 个版本,首次发布于 2019/05/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.0.34latest2022/03/304 年前
6.0.332022/03/294 年前
6.0.322022/03/284 年前
6.0.312022/01/064 年前
6.0.302021/12/164 年前
6.0.292021/12/134 年前

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

关于 @bbc/psammead-story-promo-list 的常见问题

@bbc/psammead-story-promo-list 是什么?

List of story promos

如何安装 @bbc/psammead-story-promo-list?

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

@bbc/psammead-story-promo-list 支持 TypeScript 吗?

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

@bbc/psammead-story-promo-list 支持 ESM 还是 CommonJS?

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

@bbc/psammead-story-promo-list 可以商用吗?

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

@bbc/psammead-story-promo-list 的下载量有多少?

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

@bbc/psammead-story-promo-list 还在维护吗?

最新版本 6.0.34 发布于 2022/03/30(4 年前);至今共发布 109 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/05/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。