forgeplus-react/src/forge/Merge/Commits.jsx

38 lines
1.4 KiB
React
Raw Normal View History

2020-11-06 16:30:01 +08:00
import React from 'react';
2020-11-05 11:31:26 +08:00
import { AlignCenter , FlexAJ } from '../Component/layout';
import User from '../Component/User';
import { truncateCommitId } from '../common/util';
import { getImageUrl } from 'educoder';
2020-11-06 16:30:01 +08:00
import Nodata from '../Nodata';
2020-11-05 11:31:26 +08:00
2020-11-06 16:30:01 +08:00
function Commits({commits}){
2020-11-05 11:31:26 +08:00
return(
2020-11-06 16:30:01 +08:00
commits && commits.length>0 ?
2020-11-05 11:31:26 +08:00
<div className="pb20">
{
2020-11-06 16:30:01 +08:00
commits.map((item,key)=>{
2020-11-05 11:31:26 +08:00
return(
<div className="prCommits">
<p className="prCreate">{item.created_at}</p>
<div className="prInfo">
<FlexAJ>
<AlignCenter>
<span className="commitKey" style={{marginLeft:0}}>{truncateCommitId(`${item.sha}`)}</span>
2020-11-06 16:30:01 +08:00
<p className="ml15 font-16 color-grey-3 task-hide" style={{maxWidth:"700px"}}>{item.message}</p>
2020-11-05 11:31:26 +08:00
</AlignCenter>
{/* <Link to={""} className="color-blue">浏览代码</Link> */}
<AlignCenter>
<User url={getImageUrl(`images/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>提交于{item.time_from_now}</span>
</AlignCenter>
</FlexAJ>
</div>
</div>
)
})
}
</div>
2020-11-06 16:30:01 +08:00
:
<Nodata _html="暂无提交记录~"/>
2020-11-05 11:31:26 +08:00
)
}
export default Commits;