Skip to content

Commit 9a6b852

Browse files
committed
Display promote button on the row
1 parent 0938cb4 commit 9a6b852

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

site/src/components/VersionsTable/VersionRow.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Button from "@material-ui/core/Button"
12
import { makeStyles } from "@material-ui/core/styles"
23
import TableCell from "@material-ui/core/TableCell"
34
import { TemplateVersion } from "api/typesGenerated"
@@ -8,6 +9,7 @@ import { UserAvatar } from "components/UserAvatar/UserAvatar"
89
import { useClickableTableRow } from "hooks/useClickableTableRow"
910
import { useTranslation } from "react-i18next"
1011
import { useNavigate } from "react-router-dom"
12+
import { colors } from "theme/colors"
1113
import { combineClasses } from "util/combineClasses"
1214

1315
export interface VersionRowProps {
@@ -32,6 +34,7 @@ export const VersionRow: React.FC<VersionRowProps> = ({
3234
{...clickableProps}
3335
className={combineClasses({
3436
[clickableProps.className]: true,
37+
[styles.row]: true,
3538
[styles.active]: isActive,
3639
})}
3740
>
@@ -63,14 +66,39 @@ export const VersionRow: React.FC<VersionRowProps> = ({
6366
</span>
6467
</Stack>
6568
</Stack>
66-
{isActive && <Pill text="Active version" type="success" />}
69+
{isActive ? (
70+
<Pill text="Active version" type="success" />
71+
) : (
72+
<Button
73+
size="small"
74+
variant="outlined"
75+
className={styles.promoteButton}
76+
>
77+
Promote version
78+
</Button>
79+
)}
6780
</Stack>
6881
</TableCell>
6982
</TimelineEntry>
7083
)
7184
}
7285

7386
const useStyles = makeStyles((theme) => ({
87+
row: {
88+
"&:hover $promoteButton": {
89+
color: theme.palette.text.primary,
90+
borderColor: colors.gray[11],
91+
"&:hover": {
92+
borderColor: theme.palette.text.primary,
93+
},
94+
},
95+
},
96+
97+
promoteButton: {
98+
color: theme.palette.text.secondary,
99+
transition: "none",
100+
},
101+
74102
versionWrapper: {
75103
padding: theme.spacing(2, 4),
76104
},

0 commit comments

Comments
 (0)