Improved button styling

Added toast when collection permissions are saved
Removed usage of setState (old habits die hard)
This commit is contained in:
Tom Moor
2019-01-05 18:23:57 -08:00
parent 713473b7d2
commit f80e4ab04c
11 changed files with 131 additions and 112 deletions

View File

@@ -1,5 +1,7 @@
// @flow
import * as React from 'react';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import styled from 'styled-components';
import Tip from './Tip';
import CopyToClipboard from './CopyToClipboard';
@@ -9,17 +11,12 @@ type Props = {
team: Team,
};
type State = {
linkCopied: boolean,
};
class TipInvite extends React.Component<Props, State> {
state = {
linkCopied: false,
};
@observer
class TipInvite extends React.Component<Props> {
@observable linkCopied: boolean = false;
handleCopy = () => {
this.setState({ linkCopied: true });
this.linkCopied = true;
};
render() {
@@ -35,7 +32,7 @@ class TipInvite extends React.Component<Props, State> {
{' '}
<CopyToClipboard text={team.url} onCopy={this.handleCopy}>
<a>
{this.state.linkCopied
{this.linkCopied
? 'link copied to clipboard!'
: 'copy a link to share.'}
</a>