forked from newthuhole/hole_thu_frontend
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
832 B
31 lines
832 B
import React, {Component} from 'react'; |
|
import TimeAgo from 'react-timeago'; |
|
import chineseStrings from 'react-timeago/lib/language-strings/zh-CN'; |
|
import buildFormatter from 'react-timeago/lib/formatters/buildFormatter'; |
|
import './Common.css'; |
|
|
|
const chinese_format=buildFormatter(chineseStrings); |
|
|
|
function pad2(x) { |
|
return x<10 ? '0'+x : ''+x; |
|
} |
|
|
|
export function Time(props) { |
|
const time=new Date(props.stamp*1000); |
|
return ( |
|
<span> |
|
<TimeAgo date={time} formatter={chinese_format} /> |
|
|
|
{time.getMonth()+1}-{time.getDate()} |
|
{time.getHours()}:{pad2(time.getMinutes())} |
|
</span> |
|
); |
|
} |
|
|
|
export function CenteredLine(props) { |
|
return ( |
|
<p className="centered-line aux-margin"> |
|
<span>{props.text}</span> |
|
</p> |
|
) |
|
} |