How to use reading-time - 10 common examples

To help you get started, we’ve selected a few reading-time examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github selbekk / react-christmas / pages / [year] / [date].js View on Github external
try {
    const {
      default: { attributes, html }
    } = await import(`../../content/${query.year}/${paddedDate}.md`);

    const authorInfo = await getAuthors(attributes.author);
    const post = {
      html,
      ...attributes,
      author: authorInfo
    };
    return {
      post,
      year: Number(query.year),
      date: Number(query.date),
      readingTime: calculateReadingTime(post.html).text
    };
  } catch (e) {
    console.error('such error', e);
    return {
      year: Number(query.year),
      date: Number(query.date),
      notFound: true
    };
  }
};
export default withRouter(PostPage);
github Waiviogit / waivio / src / client / components / Editor / Editor.js View on Github external
render() {
    const { intl, form, loading, isUpdating, saving, draftId } = this.props;
    const { getFieldDecorator } = form;
    const {
      body,
      bodyHTML,
      linkedObjects,
      influenceRemain,
      isLinkedObjectsValid,
      canCreateNewObject,
    } = this.state;

    const { words, minutes } = readingTime(bodyHTML);

    const linkedObjectsTitle = (
      <div>
        
          }
        &gt;
          <label>
            
          </label>
        
      </div>
github panjf2000 / gnet / src / theme / BlogPostPage / index.js View on Github external
function BlogPostPage(props) {
  const {content: BlogPostContents} = props;
  const {frontMatter, metadata} = BlogPostContents;
  const {author_github, id, title} = frontMatter;
  const {date: dateString, tags} = metadata;
  const readingStats = readingTime(BlogPostContents.toString());
  const date = new Date(Date.parse(dateString));
  const domainTag = enrichTags(tags, 'blog').find(tag =&gt; tag.category == 'domain');
  const domain = domainTag ? domainTag.value : null;
  const newPost = fetchNewPost();

  if (newPost &amp;&amp; newPost.id == id) {
    viewedNewPost();
  }

  return (
    
      <article>
        <header>
          <div>
            <div class="hero--avatar">
              </div></div></header></article>
github busyorg / busy / src / client / components / Editor / Editor.js View on Github external
render() {
    const { intl, form, loading, isUpdating, saving, draftId } = this.props;
    const { getFieldDecorator } = form;
    const { body, bodyHTML } = this.state;

    const { words, minutes } = readingTime(bodyHTML);

    return (
      <form>
        
          <title>
            {intl.formatMessage({ id: 'write_post', defaultMessage: 'Write post' })} - Busy
          </title>
        
        
              
            
          }
        &gt;
          {getFieldDecorator('title', {</form>
github panjf2000 / gnet / src / theme / BlogPostItem / index.js View on Github external
function BlogPostItem(props) {
  const {
    children,
    frontMatter,
    metadata,
    truncated,
    isBlogPostPage = false,
  } = props;
  const {date: dateString, description, permalink, tags} = metadata;
  const {author_github, title} = frontMatter;
  const readingStats = readingTime(children.toString());
  const date = new Date(Date.parse(dateString));
  const domainTag = enrichTags(tags, 'blog').find(tag =&gt; tag.category == 'domain');
  const domain = domainTag ? domainTag.value : null;

  return (
    
      <article>
        <h2>{title}</h2>
        <div>{description}</div>
        <time datetime="{date.toISOString()}" pubdate="pubdate">{dateFormat(date, "mmm dS")}</time> / {readingStats.text}} rel="author" /&gt;
        
      </article>
    
  );
}
github Waiviogit / waivio / src / client / components / Story / StoryFull.js View on Github external
<span>
              
            </span>
            {Math.ceil(readingTime(post.body).minutes) &gt; 1 &amp;&amp; (
              <span>
                <span>
                
                      
                    </span>
                  }
                &gt;
                  <span>
                    
                  </span>
                
              </span>
            )}

reading-time

Medium's like reading time estimation.

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular reading-time functions