Skip to content

Instantly share code, notes, and snippets.

@DZuz14
DZuz14 / index.jsx
Last active July 9, 2021 13:38
Upload 1. Skeleton with styling
const Upload = () => {
return (
<div className="Upload" css={CSS}>
<div className="inner">
<div className="list">
<h5>Your Files:</h5>
<ul className="files">{/* file names here. */}</ul>
</div>
@DZuz14
DZuz14 / index.jsx
Last active July 8, 2021 22:43
Upload 2.
const Upload = () => {
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
return (
<div className="Upload" css={CSS}>
<div className="inner">
@DZuz14
DZuz14 / index.jsx
Last active July 8, 2021 22:42
Upload 3
const Upload = () => {
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const preventBubbling = (e) => {
e.stopPropagation()
e.preventDefault()
@DZuz14
DZuz14 / index.jsx
Last active July 8, 2021 22:54
Upload 4
const Upload = () => {
const [files, setFiles] = useState(null)
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const preventBubbling = (e) => {
e.stopPropagation()
@DZuz14
DZuz14 / index.jsx
Created July 8, 2021 22:56
Upload 5
const Upload = () => {
const [files, setFiles] = useState(null)
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const preventBubbling = (e) => {
e.stopPropagation()
@DZuz14
DZuz14 / index.jsx
Created July 8, 2021 23:20
Upload 6
const Upload = () => {
const [files, setFiles] = useState(null)
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const preventBubbling = (e) => {
e.stopPropagation()
@DZuz14
DZuz14 / index.jsx
Last active July 9, 2021 15:11
Upload 7
const Upload = () => {
const [files, setFiles] = useState(null)
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const removeFile = (name) => {
const newFiles = files.filter((file) => file.name !== name)
@DZuz14
DZuz14 / index.jsx
Created July 8, 2021 23:41
Upload 8
const Upload = () => {
const [files, setFiles] = useState([])
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const handleFiles = (fileList, mode = 'w') => {
if (mode === 'a') {
@DZuz14
DZuz14 / index.jsx
Last active July 13, 2021 15:42
Upload Last
const Upload = () => {
const [files, setFiles] = useState([])
const inputRef = useRef()
const handleClick = () => {
inputRef.current.click()
}
const handleFiles = (fileList, mode = 'w') => {
if (mode === 'a') {
@DZuz14
DZuz14 / config.json
Last active July 16, 2021 19:59
autoform 1
{
"success":"Hooray! your form was submitted.",
"fields":[
{
"name":"name",
"type":"text",
"placeholder":"Dana Scully",
"required":true,
"value": ""
},