feat: add website and folder upload and download (#260)
* feat: add website and folder upload and download * feat: download-share-upload navigation * fix: check for files length in hasIndexDocument * fix: change router dependency * refactor: switch to @ethersphere/manfest-js * fix: hide previews on dropzone, fix spinner align, hide 0 size display * feat: add upload and download history * refactor: change drag and drop text * feat: make history ux better * refactor: improve code based on review * build: add missing react-router dependency * ci: remove beeload * revert(ci): remove beeload This reverts commit 4ce6cb0045a2d9aea3047ab395d214d8d368c532.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { createContext, ReactChild, ReactElement, useState } from 'react'
|
||||
import { SwarmFile } from '../utils/SwarmFile'
|
||||
|
||||
interface ContextInterface {
|
||||
files: SwarmFile[]
|
||||
setFiles: (files: SwarmFile[]) => void
|
||||
}
|
||||
|
||||
const initialValues: ContextInterface = {
|
||||
files: [],
|
||||
setFiles: () => {}, // eslint-disable-line
|
||||
}
|
||||
|
||||
export const Context = createContext<ContextInterface>(initialValues)
|
||||
export const Consumer = Context.Consumer
|
||||
|
||||
interface Props {
|
||||
children: ReactChild
|
||||
}
|
||||
|
||||
export function Provider({ children }: Props): ReactElement {
|
||||
const [files, setFiles] = useState<SwarmFile[]>(initialValues.files)
|
||||
|
||||
return <Context.Provider value={{ files, setFiles }}>{children}</Context.Provider>
|
||||
}
|
||||
Reference in New Issue
Block a user