Skip to content

Commit

Permalink
Merge pull request #703 from ONEARMY/revert-691-593-max-image-upload
Browse files Browse the repository at this point in the history
Revert "593 max image upload"
  • Loading branch information
BenGamma authored Oct 17, 2019
2 parents b1f8625 + e0f6795 commit bcb732e
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 319 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"react-datepicker": "^2.9.6",
"react-dev-utils": "^7.0.3",
"react-dom": "16.8.4",
"react-dropzone": "^10.1.10",
"react-final-form": "6.3.0",
"react-final-form-arrays": "^3.1.1",
"react-firebase-file-uploader": "2.4.2",
Expand Down
1 change: 0 additions & 1 deletion src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export interface IBtnProps extends React.ButtonHTMLAttributes<HTMLElement> {
small?: boolean
medium?: boolean
large?: boolean
hasText?: boolean
}
export const small = (props: IBtnProps) =>
props.small
Expand Down
11 changes: 3 additions & 8 deletions src/components/FileInfo/FileInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IUploadedFileMeta } from 'src/stores/storage'
import { FileDetails } from './FileDetails'

interface IProps {
file: File | IUploadedFileMeta | null
file: File | IUploadedFileMeta
allowDownload?: boolean
}
interface IState {
Expand All @@ -17,8 +17,8 @@ export class FileInfo extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props)
this.state = {
glyph: props.file ? this.getGlyph(props.file.type) : 'image',
size: props.file ? bytesToSize(props.file.size) : '0',
glyph: this.getGlyph(props.file.type),
size: bytesToSize(props.file.size),
}
}

Expand All @@ -38,11 +38,6 @@ export class FileInfo extends React.Component<IProps, IState> {
const { file, allowDownload } = this.props
const { glyph, size } = this.state
const meta = file as IUploadedFileMeta

if (!file) {
return null
}

return (
<>
{allowDownload && meta.downloadUrl ? (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/ImageInput.field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const ImageInputField = ({ input, meta, ...rest }: IFieldProps) => (
{...rest}
// as validation happens on blur also want to artificially trigger when values change
// (no native blur event)
onFilesChange={file => {
input.onChange(file)
onFilesChange={files => {
input.onChange(files)
input.onBlur()
}}
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/Form/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const TextAreaDisabled = styled.div`

// generic container used for some custom component fields
export const FieldContainer = styled.div<IFormElement>`
height: 100%;
width: 100%;
${inputStyles};
border: none;
Expand Down
27 changes: 12 additions & 15 deletions src/components/ImageInput/ImageConverter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ const imageSizes = {
}

const PreviewImage = styled(Flex)`
height: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
height: 100%;
height: 100px;
width: 100%;
border-radius: 5px;
border: 1px solid #ececec;
Expand Down Expand Up @@ -87,19 +86,17 @@ export class ImageConverter extends React.Component<IProps, IState> {
render() {
const { convertedFile } = this.state

if (!convertedFile) {
return null
}

return (
<PreviewImage
style={{
backgroundImage: `url(${convertedFile.objectUrl})`,
}}
id="preview"
onClick={() => this.props.onImgClicked(convertedFile)}
/>
)
return convertedFile ? (
<Flex px={1} width={1 / 4}>
<PreviewImage
style={{
backgroundImage: `url(${convertedFile.objectUrl})`,
}}
id="preview"
onClick={() => this.props.onImgClicked(convertedFile)}
/>
</Flex>
) : null
}
}
ImageConverter.defaultProps = {
Expand Down
Loading

0 comments on commit bcb732e

Please sign in to comment.