-
-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Animate transaction notifications & fix styles #305
Changes from 26 commits
9ea3884
6f2bd19
60db6b4
2aa4942
88f6bd1
b9f5244
099cd0e
46af5cf
244b4c0
141ebec
d991711
038415d
dfe3afe
fb39318
d189b49
ece40e8
e8094af
e5fecd6
9d3ab19
d28da44
66b473e
dbb5644
fff9663
fbfbc6c
2c27004
176e5d5
cfee8d9
02f6fd4
7b7dfff
e8bd2bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,38 @@ import { | |
} from 'actions/notifications'; | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { TransitionGroup, CSSTransition } from 'react-transition-group'; | ||
import NotificationRow from './NotificationRow'; | ||
import './Notifications.scss'; | ||
|
||
interface Props { | ||
notifications: Notification[]; | ||
closeNotification: TCloseNotification; | ||
} | ||
|
||
const Transition = props => ( | ||
<CSSTransition | ||
{...props} | ||
classNames="animation" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would pick a more descriptive class than |
||
timeout={{ enter: 500, exit: 500 }} | ||
/> | ||
); | ||
|
||
export class Notifications extends React.Component<Props, {}> { | ||
public render() { | ||
if (!this.props.notifications.length) { | ||
return null; | ||
} | ||
return ( | ||
<div className="Notifications"> | ||
{this.props.notifications.map((n, i) => ( | ||
<NotificationRow | ||
key={`${n.level}-${i}`} | ||
notification={n} | ||
onClose={this.props.closeNotification} | ||
/> | ||
))} | ||
</div> | ||
<TransitionGroup className="Notifications"> | ||
{this.props.notifications.map(n => { | ||
return ( | ||
<Transition key={n.id}> | ||
<NotificationRow | ||
notification={n} | ||
onClose={this.props.closeNotification} | ||
/> | ||
</Transition> | ||
); | ||
})} | ||
</TransitionGroup> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't looked at the latest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For animating individual elements, like in the CSSTransition example, |
||
); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,14 +307,14 @@ export class SendTransaction extends React.Component<Props, State> { | |
onChange={readOnly ? void 0 : this.onGasChange} | ||
/> | ||
{(offline || forceOffline) && ( | ||
<div> | ||
<NonceField | ||
value={nonce} | ||
onChange={this.onNonceChange} | ||
placeholder={'0'} | ||
/> | ||
</div> | ||
)} | ||
<div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no changes here except for formatting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just added a new commit to clean up the rest of the formatting noise, the one thing I couldn't change was the indentation you highlighted, it gets formatted that way by the |
||
<NonceField | ||
value={nonce} | ||
onChange={this.onNonceChange} | ||
placeholder={'0'} | ||
/> | ||
</div> | ||
)} | ||
{unit === 'ether' && ( | ||
<DataField | ||
value={data} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,7 +168,8 @@ function* broadcastTx(action: BroadcastTxRequestedAction): SagaIterator { | |
txHash={txHash} | ||
blockExplorer={network.blockExplorer} | ||
/>, | ||
0 | ||
0, | ||
txHash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than refactor all notifications to have manually specified IDs, what if we generated random IDs for each of them? You could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
) | ||
); | ||
yield put(broadcastTxSucceded(txHash, signedTx)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,6 @@ | |
&:hover, | ||
&:focus, | ||
&.focus { | ||
color: white; | ||
text-decoration: none; | ||
opacity: 1; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaah, the ever familiar class naming of
react-transition-group
. Typically with these, I'm a big fan of:but this is completely stylistic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, your right, it is stylistic but its important to maintain consistence. Still getting used to writing in suitcss. I'll make sure I update the css.