-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update FileDropZone's documentation (#2899)
Co-authored-by: Josh Wooding <[email protected]> Co-authored-by: mikearildbrown <[email protected]>
- Loading branch information
1 parent
61072b7
commit 6481f62
Showing
6 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { ReactElement } from "react"; | ||
import { ReactElement, DragEvent } from "react"; | ||
import { | ||
FileDropZone, | ||
FileDropZoneIcon, | ||
FileDropZoneTrigger, | ||
} from "@salt-ds/lab"; | ||
import { Text } from "@salt-ds/core"; | ||
|
||
const validate = (event: DragEvent<HTMLDivElement>, files: File[]) => { | ||
console.log("validate files", files); | ||
}; | ||
|
||
export const Default = (): ReactElement => ( | ||
<FileDropZone style={{ width: 300 }}> | ||
<FileDropZone | ||
style={{ width: 300 }} | ||
onDrop={(event, files) => validate(event, files)} | ||
> | ||
<FileDropZoneIcon /> | ||
<strong>Drop files here or</strong> | ||
<FileDropZoneTrigger /> | ||
<FileDropZoneTrigger accept=".png" /> | ||
<Text>Only .png files</Text> | ||
</FileDropZone> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import { ReactElement } from "react"; | ||
import { DragEvent, ReactElement } from "react"; | ||
import { | ||
FileDropZone, | ||
FileDropZoneIcon, | ||
FileDropZoneTrigger, | ||
} from "@salt-ds/lab"; | ||
import { Text } from "@salt-ds/core"; | ||
|
||
const validate = (event: DragEvent<HTMLDivElement>, files: File[]) => { | ||
console.log("validate files", files); | ||
}; | ||
|
||
export const Disabled = (): ReactElement => ( | ||
<FileDropZone style={{ width: 300 }} disabled> | ||
<FileDropZone | ||
style={{ width: 300 }} | ||
onDrop={(event, files) => validate(event, files)} | ||
disabled | ||
> | ||
<FileDropZoneIcon /> | ||
<strong>Drop files here or</strong> | ||
<FileDropZoneTrigger disabled /> | ||
<FileDropZoneTrigger accept=".png" disabled /> | ||
<Text disabled>Only .png files</Text> | ||
</FileDropZone> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import { ReactElement } from "react"; | ||
import { DragEvent, ReactElement } from "react"; | ||
import { | ||
FileDropZone, | ||
FileDropZoneIcon, | ||
FileDropZoneTrigger, | ||
} from "@salt-ds/lab"; | ||
import { Text } from "@salt-ds/core"; | ||
|
||
const validate = (event: DragEvent<HTMLDivElement>, files: File[]) => { | ||
console.log("validate files", files); | ||
}; | ||
|
||
export const Success = (): ReactElement => ( | ||
<FileDropZone style={{ width: 300 }} status="success"> | ||
<FileDropZone | ||
style={{ width: 300 }} | ||
onDrop={(event, files) => validate(event, files)} | ||
status="success" | ||
> | ||
<FileDropZoneIcon status="success" /> | ||
<strong>Upload completed</strong> | ||
<FileDropZoneTrigger /> | ||
<FileDropZoneTrigger accept=".png" /> | ||
<Text>Only .png files</Text> | ||
</FileDropZone> | ||
); |
6481f62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
saltdesignsystem – ./
www.saltdesignsystem.com
saltdesignsystem-git-main-fed-team.vercel.app
saltdesignsystem-fed-team.vercel.app
saltdesignsystem.vercel.app
next.saltdesignsystem.com