diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-06-09 13:36:45 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-06-09 13:36:45 +0200 |
commit | 73389ad516af4cb49873cc19c2dc65efc77d6eb8 (patch) | |
tree | 85ecfb9b15c1db0b01300e7b18b0d7ad2d1a2d76 /frontend/src/components/PlayerInfo.jsx | |
parent | Fix frontend gitignore (diff) | |
download | seven-wonders-73389ad516af4cb49873cc19c2dc65efc77d6eb8.tar.gz seven-wonders-73389ad516af4cb49873cc19c2dc65efc77d6eb8.tar.bz2 seven-wonders-73389ad516af4cb49873cc19c2dc65efc77d6eb8.zip |
Split GameBrowser into multiple connected components
Diffstat (limited to 'frontend/src/components/PlayerInfo.jsx')
-rw-r--r-- | frontend/src/components/PlayerInfo.jsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/frontend/src/components/PlayerInfo.jsx b/frontend/src/components/PlayerInfo.jsx new file mode 100644 index 00000000..42d3142a --- /dev/null +++ b/frontend/src/components/PlayerInfo.jsx @@ -0,0 +1,27 @@ +// @flow +import { Text } from '@blueprintjs/core'; +import React from 'react'; +import { connect } from 'react-redux'; +import type { Player } from '../models/players'; +import { getCurrentPlayer } from '../redux/players'; + +export type PlayerInfoProps = { + player: ?Player, +} + +const PlayerInfoPresenter = ({player}: PlayerInfoProps) => ( + <Text> + <b>Username:</b> + {' '} + {player && player.displayName} + </Text> +); + +const mapStateToProps = state => ({ + player: getCurrentPlayer(state), +}); + +const mapDispatchToProps = { +}; + +export const PlayerInfo = connect(mapStateToProps, mapDispatchToProps)(PlayerInfoPresenter); |