1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

attaching files to comments

This commit is contained in:
muerwre 2019-08-28 20:28:30 +07:00
parent 498f6cd612
commit a95d12db5b
2 changed files with 27 additions and 0 deletions

View file

@ -17,6 +17,8 @@ import * as UPLOAD_ACTIONS from '~/redux/uploads/actions';
import { selectUploads } from '~/redux/uploads/selectors'; import { selectUploads } from '~/redux/uploads/selectors';
import { IState } from '~/redux/store'; import { IState } from '~/redux/store';
import pipe from 'ramda/es/pipe'; import pipe from 'ramda/es/pipe';
import { ImageUpload } from '~/components/upload/ImageUpload';
import { getImageSize } from '~/utils/dom';
const mapStateToProps = (state: IState) => ({ const mapStateToProps = (state: IState) => ({
node: selectNode(state), node: selectNode(state),
@ -125,6 +127,23 @@ const CommentFormUnconnected: FC<IProps> = ({
/> />
</div> </div>
<div className={styles.uploads}>
{comment_data[id].files.map(file => (
<ImageUpload id={file.id} thumb={getImageSize(file.url)} key={file.id} />
))}
{comment_data[id].temp_ids.map(
status =>
statuses[status] && (
<ImageUpload
id={statuses[status].uuid}
thumb={statuses[status].preview}
key={status}
progress={statuses[status].progress}
/>
)
)}
</div>
<Group horizontal className={styles.buttons}> <Group horizontal className={styles.buttons}>
<input type="file" onInput={onInputChange} /> <input type="file" onInput={onInputChange} />

View file

@ -21,3 +21,11 @@
@include outer_shadow(); @include outer_shadow();
} }
.uploads {
padding: ($gap / 2);
display: grid;
grid-column-gap: $gap / 2;
grid-row-gap: $gap / 2;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}