Skip to content

vitorcremonez/react-last-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Last Status Component

React component that shows the last status of user. Add your own last seen status to your project.

Last seen max 30.000 miliseconds ago: Online

Last seen max 1 week ago: LastWeek

Mouse over component pop title with full date: Title

Auto Refresh

The react-last-status makes auto refreshes automatically each 15.000ms.

Demo

Lorem Ipsum...

Usage

Install package:

npm install --save react-last-status

Import component:

import LastStatus from 'react-last-status';

Add component with respective props:

<LastStatus timestamp={timestamp}/>

Props

prop description
now output personalization
sameDay output personalization
lastDay output personalization
lastWeek output personalization
sameElse output personalization
timestamp timestamp of last status
locale language
nowLimiar time elapsed to consider online

Output Personalization

elapsed time status output example props default
max last nowLimiar ms online now [online]
max same day today at 00:00 sameDay [today] [at] HH:mm
max 1 day ago yesterday at 00:00 lastDay [yesterday] [at] HH:mm
max 1 week ago sunday at 00:00 lastWeek dddd [at] HH:mm
before 01/01/2018 at 00:00 sameElse L [at] HH:mm
<LastStatus
	timestamp={timestamp}
	now={'[I am alive]'}
	sameDay={'[last seen today at] HH:mm'}
	lastDay={'[last seen yesterday at] HH:mm'}
	lastWeek={'[last seen] dddd [at] HH:mm'}
	sameElse={'[last seen] L [at] HH:mm'}/>

Escaping characters

To escape characters in format strings, you can wrap the characters in square brackets.

'[today at] HH:mm' //'today at 00:00'

Languages

Set the language of component with locale prop.

<LastStatus locale={'pt-BR'}/>
locale language
en (default) English (USA)
pt-BR Portuguese (Brazil)

About

React component that shows the last status of user like: online, today at 00:00, 01/01/2018 at 00:00.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published