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

35 lines
1.5 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-10 16:42:32 +08:00
import { Link } from 'react-router-dom';
2020-11-05 11:31:26 +08:00
2020-11-10 16:42:32 +08:00
function Commits({ commits , projectsId , owner }){
2020-11-05 11:31:26 +08:00
return(
<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>
2020-11-10 18:09:38 +08:00
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0}}>{truncateCommitId(`${item.sha}`)}</Link>
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>
2020-11-10 16:42:32 +08:00
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
2020-11-05 11:31:26 +08:00
</FlexAJ>
2020-11-10 16:42:32 +08:00
<AlignCenter className="mt15">
2021-04-19 17:52:01 +08:00
<User url={getImageUrl(`/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>提交于{item.time_from_now}</span>
2020-11-10 16:42:32 +08:00
</AlignCenter>
2020-11-05 11:31:26 +08:00
</div>
</div>
)
})
}
</div>
)
}
export default Commits;