Skip to content

new | pfe-readtime #1400

@starryeyez024

Description

@starryeyez024

Component name:

  • pfe-readtime

This component includes a JavaScript function that calculates the number of words inside the wrapper tag, and based on the average amount of words read per minute of 250, it divides the number of words by 250 and applies a floor function to approximate the number of minutes it would take to read. 

Example, an article containing 2803 words divided by 250 is 11.212, and then rounding down using the floor function it should estimate 11 minutes.

Implementation Details

  • default slot should contain "minute read" which could be translated via google translate 
  • If page builder passes in a custom string, it will be used instead
<pfe-readtime>minute read</pfe-readtime>
<pfe-readtime-wrapper> {{ contents of the article }} </pfe-readtime-wrapper>

should generate:

image

^ probably without the hyphen though?

Design specification

image

https://xd.adobe.com/view/7e8cb735-cb1c-44cb-5cdb-c2b98a608a2a-08bd/screen/dddd6403-7c0e-48d9-ab2e-d17fcb6b58df/specs/

This component can use this mixin to call typography styles:

@include pfe-typography(md, $type: "text", $use-local);

Accessibility

  • not sure that there are any accessibility requirements here? As long as a screen reader can read the text, we should be good

Interaction

No interaction.

Analytics

No Analytics.

Metadata

Metadata

Assignees

Labels

design systemUpdates or issues to align components to the Red Hat Design System.functionalityFunctionality, typically pertaining to the JavaScript.new component requestpriority: lowSeverity level: 3

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions