Skip to content

Instantly share code, notes, and snippets.

@ryan2clw
Last active August 23, 2019 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan2clw/00bbdab5d69c62ee7691721e73123d88 to your computer and use it in GitHub Desktop.
Save ryan2clw/00bbdab5d69c62ee7691721e73123d88 to your computer and use it in GitHub Desktop.
Start of bingo page
import * as React from 'react'
import styled from 'styled-components';
import { connect } from 'react-redux';
// tslint:disable-next-line: no-submodule-imports
import 'bootstrap/dist/css/bootstrap.css';
import { Flex } from 'rebass';
import { Container, Row } from 'reactstrap';
import { IApplicationState, IConnectedReduxProps } from '../store/configureStore';
import { danger, clear } from '../store/messages';
const BackgroundFlex = styled(Flex)`
background: rgba(0, 0, 0, 0) linear-gradient(to right, rgb(67, 198, 172), \
rgb(25, 22, 84)) repeat scroll 0% 0%;
min-height: 680px;
color:white;
padding-top:24px;
flex-direction:column;
`
interface IMessage {
message: string,
type: string
}
interface IBingoPageProps {
message: IMessage
}
class BingoPage extends React.Component<IBingoPageProps & IConnectedReduxProps> {
componentDidMount() {
this.props.dispatch(danger("Your API call failed because you never made one"));
setTimeout(() => {
this.props.dispatch(clear());
}, 10000);
}
render() {
return (
<BackgroundFlex>
<Container>
<Row className="justify-content-center">
<div className="text-center">
{ this.props.message && this.props.message.type &&
<div className={`alert ${this.props.message.type}`}>
{this.props.message.message}
</div>
}
</div>
</Row>
</Container>
</BackgroundFlex>
)
}
}
function mapStateToProps(state: IApplicationState) {
const { message } = state;
return {
message,
}
}
export default connect(mapStateToProps)(BingoPage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment