Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 36cd7c4

Browse files
author
Noah Lee
authored
Fix to handle the overflow of commit status (#277)
1 parent dc630bd commit 36cd7c4

File tree

1 file changed

+41
-18
lines changed

1 file changed

+41
-18
lines changed

ui/src/components/StatusStateIcon.tsx

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Popover, Avatar, Typography, Row, Col, Divider } from "antd"
1+
import { Popover, Avatar, Typography, Row, Col, Divider, Space } from "antd"
22
import { CheckOutlined, CloseOutlined } from "@ant-design/icons"
33

44
import { Status, StatusState } from "../models"
@@ -14,25 +14,48 @@ interface StatusStateIconProps {
1414

1515
export default function StatusStateIcon(props: StatusStateIconProps): JSX.Element {
1616
const states = props.statuses.map((status) => status.state)
17-
const content: JSX.Element = <div style={{width: "350px"}}>
18-
{props.statuses.map((status, idx) => {
19-
return <Row key={idx}>
20-
<Col span="12">
21-
{mapStateToIcon(status.state)}&nbsp;&nbsp;
22-
<Avatar size="small" src={status.avatarUrl} shape="square"/>&nbsp;&nbsp;
23-
<Text strong>{status.context}</Text>
24-
</Col>
25-
<Col span="11" style={{textAlign: "right"}}>
26-
<Link href={status.targetUrl} target="_blank">Details</Link>
27-
</Col>
28-
{(idx !== props.statuses.length - 1)?
29-
<Divider style={{margin: "5px 0px"}}/> : null}
30-
</Row>
31-
})}
32-
</div>
17+
const content: JSX.Element = (
18+
<div style={{
19+
width: "350px",
20+
height: "200px",
21+
overflow: "scroll"
22+
}}
23+
>
24+
{props.statuses.map((status, idx) => {
25+
return (
26+
<Row key={idx}>
27+
<Col span="12">
28+
<Space>
29+
{mapStateToIcon(status.state)}
30+
<Avatar size="small" src={status.avatarUrl} shape="square"/>
31+
<Text
32+
strong
33+
ellipsis
34+
style={{
35+
width: 100,
36+
}}
37+
>
38+
{status.context}
39+
</Text>
40+
</Space>
41+
</Col>
42+
<Col span="11" style={{textAlign: "right"}}>
43+
<Link href={status.targetUrl} target="_blank">Details</Link>
44+
</Col>
45+
{(idx !== props.statuses.length - 1)?
46+
<Divider style={{margin: "5px 0px"}}/> : null}
47+
</Row>
48+
)
49+
})}
50+
</div>
51+
)
3352

3453
return (
35-
<Popover title="Statuses" content={content}>
54+
<Popover
55+
title="Statuses"
56+
trigger="click"
57+
content={content}
58+
>
3659
{mapStateToIcon(mergeStatusStates(states))}
3760
</Popover>
3861
)

0 commit comments

Comments
 (0)