npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bbc/psammead-play-button

v3.0.37

Published

Provides a play button, with optional duration, for playable media.

Downloads

626

Readme

psammead-play-button - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The PlayButton component renders a button with a 'video' or 'audio' icon and optional duration timestamp. Which icon is displayed is defined by the value of the type prop. The component displays a 'video' icon by default. This component has options for displaying a duration timestamp, which if not provided will render gracefully without. When clicked, the function passed to onClick will be called.

Installation

npm install @bbc/psammead-play-button

Props

| Argument | Type | Required | Default | Example | | -------------- | --------- | -------- | --------- | ------------------------ | | service | string | Yes | N/A | 'news' | | title | string | Yes | N/A | 'Foo.' | | onClick | function | Yes | N/A | () => {} | | duration | string | No | null | '2:30' | | durationSpoken | string | No | null | '2 minutes 30 seconds' | | datetime | string | No | null | 'PT2M30S' | | type | string | No | 'video' | 'audio' | | className | string | No | null | 'bar' | | guidanceMessage| string | No | null | 'Contains strong language.'|

Supported types

  • 'video'
  • 'audio'

Usage

A typical use case for this component would be to indicate to a user that a media asset placeholder contains playable media, which is either 'video' or 'audio' and, if applicable, its duration. A function triggering playback would be passed to the button's onClick prop.

import PlayButton from '@bbc/psammead-play-button';

<PlayButton
  service="news"
  title="Dog barks at cat."
  onClick={handleClick}
  duration="2:30"
  durationSpoken="2 minutes 30 seconds"
  datetime="PT2M30S"
  type="audio"
  guidanceMessage="Contains strong language."
/>;

When to use this component

The PlayButton component is designed to be used in a media asset placeholder containing playable media. It indicates to the user to expect 'video' or 'audio' content, as well as its duration, if applicable.

Accessibility notes

This component is expected to provide information about the playable media to screenreaders and other assistive technology. It is required that the title of the media be passed to the title prop and, if duration is to be displayed, a human-friendly version to durationSpoken. If the video has guidance information, this is also read out in the assitive text. This is used to build a string, which is rendered in a VisuallyHiddenText element. The icon is marked as aria-hidden="true", which means it should be ignored by screenreaders.

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.