Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b2acbc

Browse files
chore(site): add FileUpload stories (#12456)
Related to#12260
1 parent18d1c17 commit5b2acbc

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
importLinkfrom"@mui/material/Link";
2+
importtype{Meta,StoryObj}from"@storybook/react";
3+
import{FileUpload}from"./FileUpload";
4+
5+
constmeta:Meta<typeofFileUpload>={
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+
<Linkhref="/starter-templates">starter templates</Link> to getting
14+
started with Coder.
15+
</>
16+
),
17+
},
18+
};
19+
20+
exportdefaultmeta;
21+
typeStory=StoryObj<typeofFileUpload>;
22+
23+
exportconstDefault:Story={};
24+
25+
exportconstUploading:Story={
26+
args:{
27+
isUploading:true,
28+
},
29+
};
30+
31+
exportconstWithFile:Story={
32+
args:{
33+
file:newFile([],"template.zip"),
34+
},
35+
};

‎site/src/components/FileUpload/FileUpload.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ export const FileUpload: FC<FileUploadProps> = ({
6464
{...fileDrop}
6565
>
6666
<StackalignItems="center"spacing={1}>
67-
{isUploading ?(
68-
<CircularProgresssize={32}/>
69-
) :(
70-
<UploadIconcss={styles.icon}/>
71-
)}
67+
<divcss={styles.iconWrapper}>
68+
{isUploading ?(
69+
<CircularProgresssize={32}/>
70+
) :(
71+
<UploadIconcss={styles.icon}/>
72+
)}
73+
</div>
7274

7375
<StackalignItems="center"spacing={0.5}>
7476
<spancss={styles.title}>{title}</span>
@@ -155,6 +157,15 @@ const styles = {
155157
opacity:0.75,
156158
},
157159

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+
158169
icon:{
159170
fontSize:64,
160171
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp