Skip to content

Instantly share code, notes, and snippets.

@ryan2clw
Last active August 24, 2019 22:32
Show Gist options
  • Save ryan2clw/1e5d392ae364b3bf114b12fb25ba5d33 to your computer and use it in GitHub Desktop.
Save ryan2clw/1e5d392ae364b3bf114b12fb25ba5d33 to your computer and use it in GitHub Desktop.
Square for bingo game
import React from 'react';
import styled from 'styled-components';
import { Flex } from 'rebass';
const FlexHeight = styled(Flex)`
height: ${(props) => props.height};
min-width: 0;
height: 42px;
margin: 1px !important;
padding: 4px;
display: flex;
width: 42px;
justify-content: center;
align-items: center;
`;
interface ISquareProps {
width?: string,
height?: string,
className: string,
ticketNumber: string,
}
class Square extends React.Component<ISquareProps> {
width = () => this.props.width || "42px";
height = () => this.props.height || "42px";
render() {
return (
<FlexHeight
height={this.height()}
width={this.width()}
p={1}
justifyContent='center'
alignItems='center'
className={this.props.className}
>
{this.props.ticketNumber}
</FlexHeight>
);
}
}
export default Square;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment