Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Use upload icon for email import
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Stoiber committed Feb 11, 2019
1 parent fe6162e commit 0eb9d07
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
12 changes: 11 additions & 1 deletion src/components/emailInvitationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import { Button } from '../buttons';
import { Error } from '../formElements';
import { SectionCardFooter } from 'src/components/settingsViews/style';
import { withCurrentUser } from 'src/components/withCurrentUser';
import MediaInput from 'src/components/mediaInput';
import {
EmailInviteForm,
EmailInviteInput,
AddRow,
RemoveRow,
CustomMessageToggle,
CustomMessageTextAreaStyles,
FileUploadWrapper,
} from './style';

type Props = {
Expand Down Expand Up @@ -369,7 +371,15 @@ class EmailInvitationForm extends React.Component<Props, State> {
)}

<SectionCardFooter>
<input type="file" accept=".json" onChange={this.handleFile} />
<FileUploadWrapper>
<MediaInput
multiple={false}
accept=".json"
glyph="upload"
tipText="Import emails from .json file"
onChange={this.handleFile}
/>
</FileUploadWrapper>
<Button
loading={isLoading}
onClick={this.sendInvitations}
Expand Down
4 changes: 4 additions & 0 deletions src/components/emailInvitationForm/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export const CustomMessageToggle = styled.h4`
}
`;

export const FileUploadWrapper = styled.div`
margin-right: 16px;
`;

export const CustomMessageTextAreaStyles = {
width: '100%',
borderRadius: '8px',
Expand Down
10 changes: 4 additions & 6 deletions src/components/mediaInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export default ({
onChange,
accept = '.png, .jpg, .jpeg, .gif, .mp4',
multiple = false,
tipLocation,
tipLocation = 'top-right',
tipText = 'Upload photo',
glyph = 'photo',
}) => (
<MediaLabel>
<MediaInput
Expand All @@ -15,10 +17,6 @@ export default ({
multiple={multiple}
onChange={onChange}
/>
<Icon
glyph="photo"
tipLocation={tipLocation ? tipLocation : 'top-right'}
tipText="Upload photo"
/>
<Icon glyph={glyph} tipLocation={tipLocation} tipText={tipText} />
</MediaLabel>
);
5 changes: 5 additions & 0 deletions upload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions users-emails.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["hi@bryn.io", "hi@brianlovin.com", "hi@mxstbr.com"]
5 changes: 5 additions & 0 deletions users-with-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{ "email": "arnold@schwarzenegger.at", "name": "Arnold" },
{ "email": "elon@musk.com", "name": "Elon" },
{ "email": "notanemail", "name": "Wrong" }
]

0 comments on commit 0eb9d07

Please sign in to comment.