Last active
August 24, 2019 22:32
-
-
Save ryan2clw/1e5d392ae364b3bf114b12fb25ba5d33 to your computer and use it in GitHub Desktop.
Square for bingo game
This file contains hidden or 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
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