This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update example project dependencies and code
- Loading branch information
Showing
14 changed files
with
2,810 additions
and
2,263 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import "@storybook/addon-actions/register"; | ||
import "@storybook/addon-links/register"; |
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,11 @@ | ||
<style> | ||
html { | ||
box-sizing: border-box; | ||
} | ||
|
||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: inherit; | ||
} | ||
</style> |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
export { TicTacToeCell as default } from "./TicTacToeCell"; | ||
export { TicTacToeCell as default, TicTacToeCellProps } from "./TicTacToeCell"; |
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
58 changes: 26 additions & 32 deletions
58
examples/storybook/src/components/TicTacToeGameBoard/TicTacToeGameBoard.stories.tsx
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,44 +1,38 @@ | ||
import React, { SFC, ReactElement } from "react"; | ||
import React, { FC } from "react"; | ||
import { storiesOf } from "@storybook/react"; | ||
import { withInfo } from "@storybook/addon-info"; | ||
import { TicTacToeGameBoard } from "./TicTacToeGameBoard"; | ||
import TicTacToeCell from "../TicTacToeCell"; | ||
import TicTacToeCell, { TicTacToeCellProps } from "../TicTacToeCell"; | ||
|
||
const stories = storiesOf("Components", module); | ||
|
||
stories.add( | ||
"TicTacToeGameBoard", | ||
withInfo({ inline: true })(() => ( | ||
<div style={{ display: "flex" }}> | ||
<div style={{ width: 300, marginRight: 20 }}> | ||
<TicTacToeGameBoard cells={placeholderCells} /> | ||
</div> | ||
<div style={{ width: 300 }}> | ||
<TicTacToeGameBoard cells={gameCells} lineStyle="dashed" /> | ||
</div> | ||
stories.addDecorator(withInfo); | ||
stories.addParameters({ info: { inline: true } }); | ||
|
||
stories.add("TicTacToeGameBoard", () => ( | ||
<div style={{ display: "flex" }}> | ||
<div style={{ width: 300, marginRight: 20 }}> | ||
<TicTacToeGameBoard cells={placeholderCells} /> | ||
</div> | ||
)), | ||
); | ||
<div style={{ width: 300 }}> | ||
<TicTacToeGameBoard cells={gameCells} lineStyle="dashed" /> | ||
</div> | ||
</div> | ||
)); | ||
|
||
const PlaceholderCell: SFC<object> = () => ( | ||
const PlaceholderCell: FC = () => ( | ||
<p style={{ margin: 0, color: "#eee" }}>Cell</p> | ||
); | ||
|
||
const placeholderCells: ReactElement<any>[] = []; | ||
for (let i = 0; i < 9; i += 1) { | ||
placeholderCells.push(<PlaceholderCell key={i} />); | ||
} | ||
const placeholderCells = Array.from({ length: 9 }, (_, index) => ( | ||
<PlaceholderCell key={index} /> | ||
)); | ||
|
||
const gameCells: ReactElement<any>[] = []; | ||
const gameCellValues = "XOX O O X"; | ||
for (let y = 0; y < 3; y += 1) { | ||
for (let x = 0; x < 3; x += 1) { | ||
gameCells.push( | ||
<TicTacToeCell | ||
key={`${x}${y}`} | ||
value={gameCellValues.charAt(y * 3 + x) as any} | ||
position={{ x, y }} | ||
/>, | ||
); | ||
} | ||
} | ||
const gameCellValues = "XOX O O X".split("") as TicTacToeCellProps["value"][]; | ||
const gameCells = Array.from(gameCellValues, (char, index) => ( | ||
<TicTacToeCell | ||
key={index} | ||
value={char} | ||
position={{ x: index % 3, y: index / 3 }} | ||
/> | ||
)); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.