-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Show connect alert banner on successful connection (#1700)
closes #1314
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import {type Robot} from '../../robot' | ||
import {AlertItem} from '@opentrons/components' | ||
|
||
type State = { | ||
dismissed: boolean | ||
} | ||
|
||
export default class ConnectBanner extends React.Component <Robot, State> { | ||
constructor (props: Robot) { | ||
super(props) | ||
|
||
this.state = { | ||
dismissed: false | ||
} | ||
} | ||
|
||
render () { | ||
const {isConnected, name} = this.props | ||
const isVisible = isConnected && !this.state.dismissed | ||
const TITLE = `${name} successfully connected` | ||
if (!isVisible) { | ||
return null | ||
} | ||
return ( | ||
<AlertItem | ||
type='success' | ||
onCloseClick={() => this.setState({dismissed: true})} | ||
title={TITLE} /> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters