File tree 2 files changed +51
-5
lines changed
site/src/components/FileUpload
2 files changed +51
-5
lines changed Original file line number Diff line number Diff line change
1
+ import Link from "@mui/material/Link" ;
2
+ import type { Meta , StoryObj } from "@storybook/react" ;
3
+ import { FileUpload } from "./FileUpload" ;
4
+
5
+ const meta : Meta < typeof FileUpload > = {
6
+ title : "components/FileUpload" ,
7
+ component : FileUpload ,
8
+ args : {
9
+ title : "Upload template" ,
10
+ description : (
11
+ < >
12
+ The template has to be a .tar or .zip file. You can also use our{ " " }
13
+ < Link href = "/starter-templates" > starter templates</ Link > to getting
14
+ started with Coder.
15
+ </ >
16
+ ) ,
17
+ } ,
18
+ } ;
19
+
20
+ export default meta ;
21
+ type Story = StoryObj < typeof FileUpload > ;
22
+
23
+ export const Default : Story = { } ;
24
+
25
+ export const Uploading : Story = {
26
+ args : {
27
+ isUploading : true ,
28
+ } ,
29
+ } ;
30
+
31
+ export const WithFile : Story = {
32
+ args : {
33
+ file : new File ( [ ] , "template.zip" ) ,
34
+ } ,
35
+ } ;
Original file line number Diff line number Diff line change @@ -64,11 +64,13 @@ export const FileUpload: FC<FileUploadProps> = ({
64
64
{ ...fileDrop }
65
65
>
66
66
< Stack alignItems = "center" spacing = { 1 } >
67
- { isUploading ? (
68
- < CircularProgress size = { 32 } />
69
- ) : (
70
- < UploadIcon css = { styles . icon } />
71
- ) }
67
+ < div css = { styles . iconWrapper } >
68
+ { isUploading ? (
69
+ < CircularProgress size = { 32 } />
70
+ ) : (
71
+ < UploadIcon css = { styles . icon } />
72
+ ) }
73
+ </ div >
72
74
73
75
< Stack alignItems = "center" spacing = { 0.5 } >
74
76
< span css = { styles . title } > { title } </ span >
@@ -155,6 +157,15 @@ const styles = {
155
157
opacity : 0.75 ,
156
158
} ,
157
159
160
+ // Used to maintain the size of icon and spinner
161
+ iconWrapper : {
162
+ width : 64 ,
163
+ height : 64 ,
164
+ display : "flex" ,
165
+ alignItems : "center" ,
166
+ justifyContent : "center" ,
167
+ } ,
168
+
158
169
icon : {
159
170
fontSize : 64 ,
160
171
} ,
You can’t perform that action at this time.
0 commit comments