How to use the react-timeago.default function in react-timeago

To help you get started, we’ve selected a few react-timeago 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 insin / react-hn / src / UserProfile.js View on Github external
var React = require('react')
var ReactFireMixin = require('reactfire')
var TimeAgo = require('react-timeago').default

var HNService = require('./services/HNService')

var Spinner = require('./Spinner')

var setTitle = require('./utils/setTitle')

// TODO User submissions

// TODO User comments

var UserProfile = React.createClass({
  mixins: [ReactFireMixin],
  getInitialState() {
    return {user: {}}
  },
github insin / react-hn / src / mixins / CommentMixin.js View on Github external
var React = require('react')
var Link = require('react-router/lib/Link')
var TimeAgo = require('react-timeago').default

var ItemStore = require('../stores/ItemStore')
var SettingsStore = require('../stores/SettingsStore')

var Spinner = require('../Spinner')

var pluralise = require('../utils/pluralise')

var CommentMixin = {
  fetchAncestors(comment) {
    ItemStore.fetchCommentAncestors(comment, result => {
      if (process.env.NODE_ENV !== 'production') {
        console.info(
          'fetchAncestors(' + comment.id + ') took ' +
          result.timeTaken + ' ms for ' +
          result.itemCount + ' item' + pluralise(result.itemCount) + ' with ' +
github insin / react-hn / src / mixins / ItemMixin.js View on Github external
var React = require('react')
var Link = require('react-router/lib/Link')
var TimeAgo = require('react-timeago').default

var SettingsStore = require('../stores/SettingsStore')
var pluralise = require('../utils/pluralise')
var urlParse = require('url-parse')

var parseHost = function(url) {
  var hostname = (urlParse(url, true)).hostname
  var parts = hostname.split('.').slice(-3)
  if (parts[0] === 'www') {
    parts.shift()
  }
  return parts.join('.')
}

/**
 * Reusable logic for displaying an item.
github insin / react-hn / src / Item.js View on Github external
var React = require('react')
var ReactFireMixin = require('reactfire')
var TimeAgo = require('react-timeago').default

var HNService = require('./services/HNService')
var HNServiceRest = require('./services/HNServiceRest')
var StoryCommentThreadStore = require('./stores/StoryCommentThreadStore')
var ItemStore = require('./stores/ItemStore')

var Comment = require('./Comment')
var PollOption = require('./PollOption')
var Spinner = require('./Spinner')
var ItemMixin = require('./mixins/ItemMixin')

var cx = require('./utils/buildClassName')
var setTitle = require('./utils/setTitle')

var SettingsStore = require('./stores/SettingsStore')

react-timeago

A simple Time-Ago component for ReactJs

MIT
Latest version published 1 year ago

Package Health Score

64 / 100
Full package analysis