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

chore(site): add FileUpload stories#12456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 2 commits intomainfrombq/storybook-file-upload
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletionssite/src/components/FileUpload/FileUpload.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import Link from "@mui/material/Link";
import type { Meta, StoryObj } from "@storybook/react";
import { FileUpload } from "./FileUpload";

const meta: Meta<typeof FileUpload> = {
title: "components/FileUpload",
component: FileUpload,
args: {
title: "Upload template",
description: (
<>
The template has to be a .tar or .zip file. You can also use our{" "}
<Link href="/starter-templates">starter templates</Link> to getting
started with Coder.
</>
),
},
};

export default meta;
type Story = StoryObj<typeof FileUpload>;

export const Default: Story = {};

export const Uploading: Story = {
args: {
isUploading: true,
},
};

export const WithFile: Story = {
args: {
file: new File([], "template.zip"),
},
};
21 changes: 16 additions & 5 deletionssite/src/components/FileUpload/FileUpload.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,11 +64,13 @@ export const FileUpload: FC<FileUploadProps> = ({
{...fileDrop}
>
<Stack alignItems="center" spacing={1}>
{isUploading ? (
<CircularProgress size={32} />
) : (
<UploadIcon css={styles.icon} />
)}
<div css={styles.iconWrapper}>
{isUploading ? (
<CircularProgress size={32} />
) : (
<UploadIcon css={styles.icon} />
)}
</div>

<Stack alignItems="center" spacing={0.5}>
<span css={styles.title}>{title}</span>
Expand DownExpand Up@@ -155,6 +157,15 @@ const styles = {
opacity: 0.75,
},

// Used to maintain the size of icon and spinner
iconWrapper: {
width: 64,
height: 64,
display: "flex",
alignItems: "center",
justifyContent: "center",
},

icon: {
fontSize: 64,
},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp