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-05 14:34:05 +01:00
|
|
|
const Card = ({ file, id, small, selected, onChange }) => {
|
2020-03-02 00:21:43 +01:00
|
|
|
// TODO - adapt with the real data
|
|
|
|
const { type, size, name } = file;
|
2020-02-14 17:44:54 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<div>
|
2020-03-05 14:34:05 +01:00
|
|
|
<CardImgWrapper small={small} selected={selected}>
|
2020-03-02 00:21:43 +01:00
|
|
|
<CardPreview {...file} />
|
|
|
|
<div className="card-control-wrapper">
|
2020-03-05 14:34:05 +01:00
|
|
|
<Checkbox name={id} onChange={onChange} value={selected} />
|
2020-03-02 00:21:43 +01:00
|
|
|
</div>
|
2020-02-14 17:44:54 +01:00
|
|
|
</CardImgWrapper>
|
2020-03-05 11:21:23 +01:00
|
|
|
<Title fontSize="md" fontWeight="bold" ellipsis color="">
|
|
|
|
{name}
|
|
|
|
</Title>
|
2020-03-02 00:21:43 +01:00
|
|
|
<Description>{`${type} - ${size}`}</Description>
|
2020-02-14 17:44:54 +01:00
|
|
|
</div>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Card.defaultProps = {
|
|
|
|
file: null,
|
2020-03-02 14:33:16 +01:00
|
|
|
onChange: () => {},
|
2020-03-05 14:34:05 +01:00
|
|
|
small: false,
|
|
|
|
selected: false,
|
2020-02-14 17:44:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Card.propTypes = {
|
2020-03-02 14:33:16 +01:00
|
|
|
id: PropTypes.string.isRequired,
|
2020-02-14 17:44:54 +01:00
|
|
|
file: PropTypes.object,
|
2020-03-02 14:33:16 +01:00
|
|
|
onChange: PropTypes.func,
|
2020-03-05 14:34:05 +01:00
|
|
|
small: PropTypes.bool,
|
|
|
|
selected: PropTypes.bool,
|
2020-02-14 17:44:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Card;
|