mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
* Forms and board tweaks for small screen sizes * Re-style game status indicators * Re-style viewing/offline indicator * Better eyecons 👁 * Re-organise CSS according to ITCSS principles * Pick new font from Google Fonts * Fix up tests * Move some things into partials
42 lines
798 B
JavaScript
42 lines
798 B
JavaScript
import React from "react";
|
|
import { connect } from "react-redux";
|
|
|
|
const renderStatus = status => {
|
|
if (status == "viewing") {
|
|
return (
|
|
<img
|
|
className="game-info__opponent-status"
|
|
src="/images/eye-open.svg"
|
|
alt="viewing"
|
|
/>
|
|
);
|
|
} else {
|
|
return (
|
|
<img
|
|
className="game-info__opponent-status"
|
|
src="/images/eye-closed.svg"
|
|
alt="offline"
|
|
/>
|
|
);
|
|
}
|
|
};
|
|
|
|
const GameInfo = props => {
|
|
return (
|
|
<div className="game-info">
|
|
<p>
|
|
Playing {props.opponent} {renderStatus(props.opponentStatus)}
|
|
</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const mapStateToProps = state => {
|
|
return {
|
|
opponent: state.opponent,
|
|
opponentStatus: state.opponentStatus,
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps)(GameInfo);
|