Skip to content
Snippets Groups Projects
Commit f90d98c3 authored by Aanand Prasad's avatar Aanand Prasad Committed by Jure
Browse files

feat(ui): convert Attachments to a styled component

parent c8a3b390
No related branches found
No related tags found
No related merge requests found
import React from 'react'
import styled from 'styled-components'
import Files from './Files'
import Attachment from '../atoms/Attachment'
import classes from './Attachments.local.scss'
import Icon from '../atoms/Icon'
// TODO: show upload progress
const Root = styled.div`
display: flex;
flex-direction: column;
margin-bottom: 2em;
margin-top: 2em;
`
const Paperclip = styled.span`
color: gray;
margin-right: 10px;
`
const Filename = styled.span`
color: gray;
`
const UploadingFile = ({ file, progress, error }) => (
<Root>
<Paperclip>
<Icon color="var(--color-local, black)">paperclip</Icon>
</Paperclip>
<Filename>{error || 'Uploading…'}</Filename>
</Root>
)
const Attachments = props => (
<Files
{...props}
buttonText="Attach file"
uploadedFile={value => <Attachment key={value.url} value={value} />}
uploadingFile={({ file, progress, error }) => (
<div className={classes.uploading}>
<span className={classes.icon}>
<Icon color="var(--color-local, black)">paperclip</Icon>
</span>
<span className={classes.filename}>{error || 'Uploading…'}</span>
</div>
)}
uploadingFile={UploadingFile}
/>
)
......
.uploading {
display: flex;
flex-direction: column;
margin-bottom: 2em;
margin-top: 2em;
}
.icon {
color: gray;
margin-right: 10px;
}
.filename {
color: gray;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment