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

Commit 74d2689

Browse files
author
Noah Hanjun Lee
authored
feat: change the style of ref code (#112)
* Fix the style of ref * Change the style of rollback form
1 parent 98ff6a3 commit 74d2689

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

ui/src/components/CreatableSelect.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface CreatableSelectProps extends SelectProps<string>{
99
}
1010

1111
export interface Option {
12-
label: string
12+
label: string | JSX.Element
1313
value: string
1414
}
1515

@@ -58,7 +58,8 @@ export default function CreatableSelect(props: CreatableSelectProps): JSX.Elemen
5858
bordered={false} />
5959
<a
6060
style={{ flex: 'none', padding: '4px', display: 'block', cursor: 'pointer' }}
61-
onClick={_onClickAddItem}>
61+
onClick={_onClickAddItem}
62+
>
6263
<PlusOutlined /> Add item
6364
</a>
6465
</div>

ui/src/components/DeployForm.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from "react"
2-
import { Form, Select, Radio, Button } from "antd"
2+
import { Form, Select, Radio, Button, Typography } from "antd"
33

44
import { Branch, Commit, Tag, DeploymentType, Status, User, Env } from "../models"
55

@@ -9,6 +9,8 @@ import ApproversSelect from "./ApproversSelect"
99

1010
export type Option = Op
1111

12+
const { Text } = Typography
13+
1214
interface DeployFormProps {
1315
envs: Env[]
1416
onSelectEnv(env: Env): void
@@ -113,7 +115,7 @@ export default function DeployForm(props: DeployFormProps): JSX.Element {
113115

114116
const mapBranchToOption = (branch: Branch) => {
115117
return {
116-
label: branch.name,
118+
label: <Text className="gitploy-code" code>{branch.name}</Text>,
117119
value: branch.name
118120
} as Option
119121
}
@@ -134,7 +136,9 @@ export default function DeployForm(props: DeployFormProps): JSX.Element {
134136

135137
const mapCommitToOption = (commit: Commit) => {
136138
return {
137-
label: `${commit.sha.substr(0, 7)} - ${commit.message}`,
139+
label: <span>
140+
<Text className="gitploy-code" code>{commit.sha.substring(0, 7)}</Text> - {commit.message}
141+
</span>,
138142
value: commit.sha,
139143
} as Option
140144
}
@@ -148,7 +152,7 @@ export default function DeployForm(props: DeployFormProps): JSX.Element {
148152

149153
const mapTagToOption = (tag: Tag) => {
150154
return {
151-
label: tag.name,
155+
label: <Text className="gitploy-code" code>{tag.name}</Text>,
152156
value: tag.name
153157
} as Option
154158
}

ui/src/components/RollbackForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import moment from 'moment'
33

44
import { User, Deployment, DeploymentType, Env } from "../models"
55
import ApproversSelect from "./ApproversSelect"
6+
import DeploymentRefCode from './DeploymentRefCode'
67

78
interface RollbackFormProps {
89
envs: Env[]
@@ -82,11 +83,11 @@ export default function RollbackForm(props: RollbackFormProps): JSX.Element {
8283

8384
if (d.deployer) {
8485
option = <Select.Option key={idx} value={d.id}>
85-
{ref} deployed by <Avatar size="small" src={d.deployer.avatar} /> {d.deployer.login} {moment(d.createdAt).fromNow()}
86+
#{d.number} - <DeploymentRefCode deployment={d}/> deployed by <Avatar size="small" src={d.deployer.avatar} /> {d.deployer.login} {moment(d.createdAt).fromNow()}
8687
</Select.Option>
8788
} else {
8889
option = <Select.Option key={idx} value={d.id}>
89-
{ref} deployed {moment(d.createdAt).fromNow()}
90+
#{d.number} - <DeploymentRefCode deployment={d}/> deployed {moment(d.createdAt).fromNow()}
9091
</Select.Option>
9192
}
9293
return option

0 commit comments

Comments
 (0)