2020-02-14 17:44:54 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-03-02 00:21:43 +01:00
|
|
|
import { Checkbox } from '@buffetjs/core';
|
2020-02-14 17:44:54 +01:00
|
|
|
|
|
|
|
import CardImgWrapper from '../CardImgWrapper';
|
2020-03-02 00:21:43 +01:00
|
|
|
import CardPreview from '../CardPreview';
|
2020-02-14 17:44:54 +01:00
|
|
|
import Wrapper from './Wrapper';
|
|
|
|
import Title from './Title';
|
|
|
|
import Description from './Description';
|
|
|
|
|
2020-03-02 00:21:43 +01:00
|
|
|
const Card = ({ abort, error, file, isSmall, isUploading, isSelected }) => {
|
|
|
|
// TODO - adapt with the real data
|
|
|
|
const { type, size, name } = file;
|
2020-02-14 17:44:54 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<div>
|
2020-03-02 00:21:43 +01:00
|
|
|
<CardImgWrapper isSmall={isSmall} isSelected={isSelected}>
|
|
|
|
<CardPreview {...file} />
|
|
|
|
<div className="card-control-wrapper">
|
|
|
|
<Checkbox name={`select-${name}`} />
|
|
|
|
</div>
|
2020-02-14 17:44:54 +01:00
|
|
|
</CardImgWrapper>
|
2020-03-02 00:21:43 +01:00
|
|
|
<Title>{name}</Title>
|
|
|
|
<Description>{`${type} - ${size}`}</Description>
|
2020-02-14 17:44:54 +01:00
|
|
|
</div>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Card.defaultProps = {
|
|
|
|
abort: () => {},
|
|
|
|
error: '',
|
|
|
|
file: null,
|
2020-03-02 00:21:43 +01:00
|
|
|
isSelected: false,
|
2020-02-14 17:44:54 +01:00
|
|
|
isSmall: false,
|
|
|
|
isUploading: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
Card.propTypes = {
|
|
|
|
abort: PropTypes.func,
|
|
|
|
error: PropTypes.string,
|
|
|
|
file: PropTypes.object,
|
2020-03-02 00:21:43 +01:00
|
|
|
isSelected: PropTypes.bool,
|
2020-02-14 17:44:54 +01:00
|
|
|
isSmall: PropTypes.bool,
|
|
|
|
isUploading: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Card;
|