-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create call to action card component. Add cta cards to home page for …
…each game
- Loading branch information
1 parent
1e88f36
commit e104328
Showing
12 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Button, Box, Text, Card, Image, Heading, Flex } from "rebass/styled-components"; | ||
|
||
const sizeToLeftWidth = (sizeNum) => { | ||
if (sizeNum > 1) return ["20em", "22em"]; | ||
return ["14em", "16em"]; | ||
} | ||
|
||
const sizeToRightWidth = (sizeNum) => { | ||
if (sizeNum > 1) return ["14em", "16em"]; | ||
return ["10em", "12em"]; | ||
} | ||
|
||
const CallToActionCard = ({ | ||
size = 1, | ||
imageSrc, | ||
imageAlt, | ||
headingText, | ||
bodyText, | ||
onCallToAction, | ||
buttonLabel | ||
}) => ( | ||
<Card m={3}> | ||
<Flex flexDirection="row" height="100%"> | ||
<Flex width={sizeToLeftWidth(size)} backgroundColor="gray" alignItems="center" justifyContent="center" m={3}> | ||
<Image src={imageSrc} alt={imageAlt} /> | ||
</Flex> | ||
<Box width={sizeToRightWidth(size)} m={3} pt={2}> | ||
<Heading>{headingText}</Heading> | ||
<Text>{bodyText}</Text> | ||
<Flex justifyContent="end" mt={3}> | ||
<Button | ||
onClick={onCallToAction} | ||
onKeyPress={onCallToAction} | ||
variant="primary" | ||
> | ||
{buttonLabel} | ||
</Button> | ||
</Flex> | ||
</Box> | ||
</Flex> | ||
</Card> | ||
); | ||
|
||
export default CallToActionCard; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import CallToActionCard from "./CallToActionCard"; | ||
export default CallToActionCard; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import game from "./game"; | ||
import { Host, Guest } from "./client"; | ||
import presetTheme from '@rebass/preset' | ||
import thumbnail from "./chess.jpg" | ||
|
||
const name = "Chess"; | ||
const theme = presetTheme; | ||
|
||
const Chess = { name, theme, Host, Guest, game }; | ||
const description = "Chess is a recreational and competitive board game played between two players."; | ||
const image = { alt: "A chess board", src: thumbnail } | ||
|
||
const Chess = { name, theme, image, description, Host, Guest, game }; | ||
|
||
export default Chess; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import game from "./game"; | ||
import { Host, Guest } from "./client"; | ||
import thumbnail from "./tic-tac-toe.jpg"; | ||
|
||
const name = "Tic Tac Toe"; | ||
const description = "a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid." | ||
const image = { alt: "tic tac toe", src: thumbnail } | ||
|
||
const TicTacToe = { name, Host, Guest, game }; | ||
const TicTacToe = { name, description, image, Host, Guest, game }; | ||
|
||
export default TicTacToe; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { withPlayers } from "components/players"; | ||
import game from "./game"; | ||
import { Host, Guest } from "./client"; | ||
import thumbnail from "./whist.jpg"; | ||
|
||
const name = "Whist"; | ||
const description = "Whist is a classic English trick-taking card game which was widely played in the 18th and 19th centuries." | ||
const image = { alt: "whist game", src: thumbnail } | ||
|
||
const playersOptions = { minPlayers: 4, maxPlayers: 4 } | ||
|
||
const Whist = withPlayers(playersOptions, { name, Host, Guest, game }); | ||
const Whist = withPlayers(playersOptions, { name, description, image, Host, Guest, game }); | ||
|
||
export default Whist; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.