mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
* beginning ESM transition: Ceramic libraries, Next.js, & TypeScript configuration 🇭🇰 * updating Chakra, React, & Next image `import`s 👔 * upgrading `@types/react`, import extensions for Node, & b64 SVG to PNG ⛹🏿♀️ * fixing relative import names & upddating @types packages 📻 * removoing WYSIWYG editor, draft-js, & updating express ⛹🏿♀️ * updating OpenSea 🚲 * ¡@metafam/utils is building! 📰 * ¡Discord bot is building! 👘 * ¡backend is building! 🛩 * fixed everything but Ceramic DID update 🏍 * switching to DID:PKH 📦 * fixing "only one child allowed" error 🙇🏿♀️ * importing `React` as required by tsc's `isolatedModules` 🇲🇰 * disabling testing rather than taking the time to fix jest ⚜ * removing set `types` from `tsconfig` to fix compilation error 🥦 * printing tests disabled warning, hopefully 🙀 * setting file to be copied to the new resolver 👁️🗨️ * "paths-resolver" not "paths-resolve" 🦴 * switching back to relative paths rather than trying to fix `paths` ⏳ * `yarn backend:dev` not working, testing GitHub build 🎺 * removing design system build & fixing some images ✊🏿 * fixed "expected function got string" error & trying to address undefined HTMLElement 🐡 * fixing @emotion/react tree shaking by making external 🏏 * including eslint config in Dockerfile 🌾 * fixing more images 🎯 * updating DIDs & switching back to an updated DID:3 ❇ * switching to w3s.link gateway & fixing early termination of storage endpoint 🔭 * switching back to ipfs.io gateway b/c w3s.link serves SVGs as application/xml which are CORB blocked 🥾 * fixing node config name in eslint ignore & shortening some paths 🧰 * fixing ts-node not handling project references 🥁
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import {
|
|
Box,
|
|
Flex,
|
|
FormControl,
|
|
FormControlProps,
|
|
FormLabel,
|
|
IconButton,
|
|
SmallCloseIcon,
|
|
Text,
|
|
} from '@metafam/ds';
|
|
import { DropFilesType } from 'lib/hooks/useDropFiles';
|
|
import React from 'react';
|
|
|
|
export const UploadFilesForm = ({
|
|
dropzoneProps,
|
|
inputProps,
|
|
onOpenFilesInput,
|
|
onRemoveFile,
|
|
files,
|
|
label = 'Upload files',
|
|
labelColor = 'white',
|
|
formControlProps = {},
|
|
}: DropFilesType & {
|
|
label?: string;
|
|
labelColor?: string;
|
|
formControlProps?: FormControlProps;
|
|
}) => (
|
|
<>
|
|
<FormControl {...formControlProps}>
|
|
<FormLabel color={labelColor} htmlFor="fileInput">
|
|
{label}
|
|
</FormLabel>
|
|
<Flex
|
|
{...dropzoneProps}
|
|
flexDir="column"
|
|
borderWidth={1}
|
|
borderStyle="dashed"
|
|
borderRadius={20}
|
|
p={10}
|
|
mb={4}
|
|
onClick={onOpenFilesInput}
|
|
>
|
|
<input {...inputProps} id="fileInput" color="white" />
|
|
<Box alignSelf="center">{`Drag 'n' drop some files here`}</Box>
|
|
</Flex>
|
|
</FormControl>
|
|
{files.length > 0 && <Text mb={1}>Files:</Text>}
|
|
{files.map((file: File) => (
|
|
<Flex key={file.name} w="100%" mb={1}>
|
|
<IconButton
|
|
size="xs"
|
|
borderRadius="full"
|
|
onClick={() => onRemoveFile(file)}
|
|
icon={<SmallCloseIcon boxSize="1rem" />}
|
|
aria-label={''}
|
|
/>
|
|
<Text ml={1} alignSelf="center">
|
|
{file.name} - {file.size} bytes
|
|
</Text>
|
|
</Flex>
|
|
))}
|
|
</>
|
|
);
|