@@ -4,6 +4,8 @@ import Link from "@material-ui/core/Link"
4
4
import { makeStyles } from "@material-ui/core/styles"
5
5
import AddCircleOutline from "@material-ui/icons/AddCircleOutline"
6
6
import SettingsOutlined from "@material-ui/icons/SettingsOutlined"
7
+ import { DeleteButton } from "components/DropdownButton/ActionCtas"
8
+ import { DropdownButton } from "components/DropdownButton/DropdownButton"
7
9
import frontMatter from "front-matter"
8
10
import { FC } from "react"
9
11
import ReactMarkdown from "react-markdown"
@@ -36,13 +38,15 @@ export interface TemplatePageViewProps {
36
38
activeTemplateVersion : TemplateVersion
37
39
templateResources : WorkspaceResource [ ]
38
40
templateVersions ?: TemplateVersion [ ]
41
+ handleDeleteTemplate : ( templateId : string ) => void
39
42
}
40
43
41
44
export const TemplatePageView : FC < React . PropsWithChildren < TemplatePageViewProps > > = ( {
42
45
template,
43
46
activeTemplateVersion,
44
47
templateResources,
45
48
templateVersions,
49
+ handleDeleteTemplate
46
50
} ) => {
47
51
const styles = useStyles ( )
48
52
const readme = frontMatter ( activeTemplateVersion . readme )
@@ -66,13 +70,22 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
66
70
{ Language . settingsButton }
67
71
</ Button >
68
72
</ Link >
69
- < Link
70
- underline = "none"
71
- component = { RouterLink }
72
- to = { `/templates/${ template . name } /workspace` }
73
- >
74
- < Button startIcon = { < AddCircleOutline /> } > { Language . createButton } </ Button >
75
- </ Link >
73
+
74
+ < DropdownButton
75
+ primaryAction = {
76
+ < Link
77
+ underline = "none"
78
+ component = { RouterLink }
79
+ to = { `/templates/${ template . name } /workspace` }
80
+ >
81
+ < Button startIcon = { < AddCircleOutline /> } > { Language . createButton } </ Button >
82
+ </ Link >
83
+ }
84
+ secondaryActions = { [
85
+ { action : "delete" , button : < DeleteButton handleAction = { ( ) => handleDeleteTemplate ( template . id ) } /> }
86
+ ] }
87
+ canCancel = { false }
88
+ />
76
89
</ Stack >
77
90
}
78
91
>
0 commit comments