@bbc/psammead-most-read

中文文档
6.1.0发布于 2021/06/03Apache-2.0ESM + CJS近 30 天下载 2761

最已读项目的一个组件

中文使用文档
文档目录20 节
  1. 说明
  2. 安装
  3. 构成部分
  4. 多读列表
  5. 道具
  6. 使用量
  7. 大多数读取项目
  8. 道具
  9. 使用量
  10. 多数读取Rank
  11. 道具
  12. 使用量
  13. 多读链接
  14. 道具
  15. 使用量
  16. 何时使用这些组件
  17. 无障碍说明
  18. 捐款
  19. 行为守则
  20. 许可证

{\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}最爱读的 Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

说明

这个 MostRead 组件旨在显示给定的、取决于服务时间的最受读取的文章。 构成部分包括: MostReadList 包含命令列表 MostReadItemWrapperA级 MostReadItemWrapper 是由下列项目组成的清单项目: MostReadLink,与文章的链接,以及 MostReadRank 代表文章排名的数字计数器.

这个 MostReadLink 财务报告和审定财务报表 MostReadRank 组件还支持大小道具。 此道具目前只接受一个 default 财务报告和审定财务报表 small 尺寸。 这些值在内部改变了用于部分组件缩放的CSS. 这将允许今后增加更多的尺寸.

安装

npm install @bbc/psammead-most-read

构成部分

多读列表

道具

参数类型需求默认示例
项目数编号对不详10
儿童节点对不详<MostReadItemWrapper dir="ltr"><MostReadRank service="news" script={latin} listIndex={1} numberOfItems={10} dir="ltr" /> <MostReadLink dir="ltr" href="/bbc.co.uk/news/articles/27051997" service="news" script={latin} title="This is a news article headline" /></MostReadItemWrapper>,
目录字符串对'尔''ltr'
拉尤特纵队字符串没有"多科伦"twoColumn

使用量

此组件将与其他最常读组件结合使用,示例见下文.

import React from 'react';
import {
  MostReadList,
  MostReadLink,
  MostReadRank,
  MostReadItemWrapper,
} from '@bbc/psammead-most-read';
import { latin } from '@bbc/gel-foundations/scripts';

<MostReadList
  items={items}
  service="news"
  script={latin}
  dir="ltr"
  columnLayout="twoColumn"
>
  <MostReadItemWrapper dir="ltr" children columnLayout="twoColumn">
    <MostReadRank
      service="news"
      script={latin}
      listIndex={1}
      numberOfItems={10}
      dir="ltr"
      columnLayout="twoColumn"
    />
    <MostReadLink
      dir="ltr"
      href="/bbc.co.uk/news/articles/27051997"
      service="news"
      script={latin}
      title="This is a news article headline"
    />
  </MostReadItemWrapper>
</MostReadList>;

大多数读取项目

道具

参数类型需求默认示例
目录字符串对'尔''ltr'
儿童节点对不详<MostReadRank service="news" script={latin} listIndex={1} numberOfItems={10} dir="ltr" /> <MostReadLink dir="ltr" href="/bbc.co.uk/news/articles/27051997" service="news" script={latin} title="This is a news article headline" />
拉尤特纵队字符串没有"多科伦"twoColumn

使用量

此组件用于包接 MostReadLink 财务报告和审定财务报表 MostReadRank 如下文所示.

import React from 'react';
import { latin } from '@bbc/gel-foundations/scripts';
import {
  MostReadLink,
  MostReadRank,
  MostReadItemWrapper,
} from '@bbc/psammead-most-read';
<MostReadItemWrapper dir="ltr" children columnLayout="twoColumn">
  <MostReadRank
    service="news"
    script={latin}
    listIndex={1}
    numberOfItems={10}
    dir="ltr"
    columnLayout="twoColumn"
  />
  <MostReadLink
    dir="ltr"
    script={latin}
    service="news"
    title="This is a article headline"
    href="/bbc.co.uk/news/00000027051997"
  />
</MostReadItemWrapper>;

多数读取Rank

道具

参数类型需求默认示例
服务字符串对不详'news'
脚本对象对不详{ 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' } } }
列表索引编号对不详1
项目数编号对不详10
目录字符串没有"ltr""ltr"
拉尤特纵队字符串没有"多科伦"twoColumn
大小字符串没有'默认''small'

使用量

import React from 'react';
import { latin } from '@bbc/gel-foundations/scripts';
import { MostReadRank } from '@bbc/psammead-most-read';

<MostReadRank
  service="news"
  script={latin}
  listIndex={1}
  numberOfItems={5}
  dir="ltr"
  columnLayout="twoColumn"
  size="small"
/>;

道具

参数类型需求默认示例
目录字符串对'尔''ltr'
服务字符串对不详'news'
脚本对象对不详{ 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' } } }
标题字符串对不详"This is a article headline"
小时字符串对不详"/bbc.co.uk/news/00000027051997"
儿童节点没有无效<Timestamp datetime="2019-03-01T14:00+00:00" script={script} padding={false} service={service}>Last updated: 5th November 2016</Timestamp>
大小字符串没有'默认''small'

使用量

此组件的典型使用例如下所示。 它包含一个信息元素. 信息元素是一个链接,它指向相应的文章.

import React from 'react';
import { latin } from '@bbc/gel-foundations/scripts';
import { MostReadLink } from '@bbc/psammead-most-read';
import Timestamp from '@bbc/psammead-timestamp';

<MostReadLink
  dir="ltr"
  script={latin}
  service="news"
  title="This is a article headline"
  href="/bbc.co.uk/news/00000027051997"
  size="small"
>
  <Timestamp
    datetime="2019-03-01T14:00+00:00"
    script={script}
    padding={false}
    service={service}
  >
    Last updated: 5th November 2016
  </Timestamp>
</MostReadLink>;

何时使用这些组件

这些组件拟用于: article, (中文(简体) ), front, (中文(简体) ), story 财务报告和审定财务报表 mostRead 页面.

无障碍说明

  • 这些组件预计将在使用屏幕读取器时提供命令列表中最读取的文章的信息,方法是宣布区域地标,读出标题"最读取",并按正确的顺序读出每个标题链接.
  • 由于faux区块链接代码,预计不会也读出军衔.

捐款

Psammead完全开源. 我们感谢任何贡献,无论是新的组件、错误修正还是总体改进。 请参看我们的主要贡献指南,可查阅: psammead 仓库的根。 。 。 .

行为守则

我们欢迎对这项工作的反馈和帮助。 通过参与这个项目,你同意遵守 行为守则请稍候再读一下.

许可证

萨姆米德 Apache 2.0 许可。 。 。 .

版本与发布记录

@bbc/psammead-most-read 共发布 109 个版本,首次发布于 2019/10/31;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.1.0latest2021/06/035 年前
6.0.312021/05/275 年前
6.0.302021/05/265 年前
6.0.292021/05/105 年前
6.0.282021/03/165 年前
6.0.272021/03/105 年前

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

关于 @bbc/psammead-most-read 的常见问题

@bbc/psammead-most-read 是什么?

最已读项目的一个组件

如何安装 @bbc/psammead-most-read?

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

@bbc/psammead-most-read 支持 TypeScript 吗?

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

@bbc/psammead-most-read 支持 ESM 还是 CommonJS?

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

@bbc/psammead-most-read 可以商用吗?

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

@bbc/psammead-most-read 的下载量有多少?

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

@bbc/psammead-most-read 还在维护吗?

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