代码库:提交信息的显示和隐藏

This commit is contained in:
caishi 2021-06-21 17:52:48 +08:00
parent c10799b6d0
commit fad42414dc
2 changed files with 22 additions and 14 deletions

View File

@ -107,6 +107,7 @@ function CoderDepot(props){
setMainFlag(true);
setReadOnly(true);
setReadme(result.data.readme);
setHide(true);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@ -118,7 +119,7 @@ function CoderDepot(props){
let ele = document.getElementById("ptxt");
if(ele){
let h = ele.offsetHeight;
if( h > 18 ) setHideBtn(true)
if( h > 18 ) setHideBtn(true);
}
}
},[projectDetail,lastCommit])
@ -149,6 +150,7 @@ function CoderDepot(props){
setLastCommitAuthor(c && c.committer);
setMainFlag(false);
setReadOnly(true);
setHide(true);
}
setTimeout(function(){setIsSpin(false);},500)
}).catch(error=>{setIsSpin(false);})
@ -332,7 +334,9 @@ function CoderDepot(props){
lastCommit &&
<div className="listtablehead">
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
<div className={hideBtn && hide ? "ellipsistxt hide" :"ellipsistxt"}><pre id="ptxt">{lastCommit && lastCommit.message}</pre></div>
<div className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
<pre id="ptxt">{lastCommit && lastCommit.message}</pre>
</div>
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
<span className="ml12 color-grey-9 mt3">{lastCommit && lastCommit.time_from_now}</span>

View File

@ -200,35 +200,39 @@
.listtablehead{
display: flex;
justify-content: space-between;
align-items: center;
align-items: flex-start;
border-bottom: 1px solid #d9d9d9;
padding:7px 20px;
border-radius: 4px 4px 0px 0px;
background-color: #FAFBFC;
.ellipsistxt{
margin-top: 6px;
#ptxt{
margin-bottom: 0px;
word-break: break-all;
overflow: unset;
white-space:pre-wrap; /* css3.0 */
white-space:-moz-pre-wrap; /* Firefox */
white-space:-pre-wrap; /* Opera 4-6 */
white-space:-o-pre-wrap; /* Opera 7 */
word-wrap:break-word;
}
margin-left: 13px;
line-height:18px;
flex:1;
width: 0;
color: #666;
&>p{
word-break:break-all;
}
&.hide{
&.hidetxt{
height: 18px;
overflow: hidden;
position: relative;
padding-right:8px;
}
&.hide::after{
position: absolute;
right: 0px;
bottom: 0px;
content:"...";
&::after{
position: absolute;
right: 0px;
bottom: 0px;
content:"...";
}
}
}
.ellipsis{