Skip to content

Commit b866ad3

Browse files
committed
feat: stub out game components
1 parent 0278dec commit b866ad3

File tree

10 files changed

+123
-0
lines changed

10 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ReactNode } from 'react';
2+
3+
export interface GameBottomBarProps {
4+
// TODO
5+
}
6+
7+
export const GameBottomBar: React.FC<GameBottomBarProps> = (
8+
props: GameBottomBarProps
9+
): ReactNode => {
10+
return <></>;
11+
};
12+
13+
GameBottomBar.displayName = 'GameBottomBar';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './game-bottom-bar';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { type ReactNode, useState } from 'react';
2+
import { GameProvider } from '../../context/game';
3+
import { GameBottomBar } from '../game-bottom-bar';
4+
import { GameGrid } from '../game-grid';
5+
import { GameSettings } from '../game-settings';
6+
import { GameTopBar } from '../game-top-bar';
7+
8+
export interface GameContainerProps {
9+
// TODO
10+
}
11+
12+
export const GameContainer: React.FC<GameContainerProps> = (
13+
props: GameContainerProps
14+
): ReactNode => {
15+
const [showSettings, setShowSettings] = useState<boolean>(true);
16+
17+
return (
18+
<GameProvider>
19+
<GameTopBar />
20+
<GameGrid />
21+
<GameBottomBar />
22+
<GameSettings
23+
show={showSettings}
24+
onHide={() => {
25+
setShowSettings(false);
26+
// setTimeout(() => {
27+
// setShowSettings(true);
28+
// }, 10_000);
29+
}}
30+
/>
31+
</GameProvider>
32+
);
33+
};
34+
35+
GameContainer.displayName = 'GameContainer';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './game-container';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { ReactNode } from 'react';
2+
import GridPage from '../../pages/grid';
3+
4+
export interface GameGridProps {
5+
// TODO
6+
}
7+
8+
export const GameGrid: React.FC<GameGridProps> = (
9+
props: GameGridProps
10+
): ReactNode => {
11+
return <GridPage />;
12+
};
13+
14+
GameGrid.displayName = 'GameGrid';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './game-grid';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {
2+
EuiFlyout,
3+
EuiFlyoutBody,
4+
EuiFlyoutHeader,
5+
EuiTitle,
6+
} from '@elastic/eui';
7+
import { type ReactNode, useEffect, useState } from 'react';
8+
9+
export interface GameSettingsProps {
10+
show: boolean;
11+
onHide: () => void;
12+
}
13+
14+
export const GameSettings: React.FC<GameSettingsProps> = (
15+
props: GameSettingsProps
16+
): ReactNode => {
17+
const { show, onHide } = props;
18+
19+
const [settingsPanel, setSettingsPanel] = useState<ReactNode>(null);
20+
21+
useEffect(() => {
22+
if (show) {
23+
setSettingsPanel(
24+
<EuiFlyout side="left" onClose={() => onHide()}>
25+
<EuiFlyoutHeader hasBorder={true}>
26+
<EuiTitle>
27+
<h2>Settings</h2>
28+
</EuiTitle>
29+
</EuiFlyoutHeader>
30+
<EuiFlyoutBody>stuff here</EuiFlyoutBody>
31+
</EuiFlyout>
32+
);
33+
} else {
34+
// In order for the flyout overlay to go away then we must
35+
// remove the flyout from the DOM.
36+
setSettingsPanel(null);
37+
}
38+
}, [show, onHide]);
39+
40+
return settingsPanel;
41+
};
42+
43+
GameSettings.displayName = 'GameSettings';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './game-settings';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ReactNode } from 'react';
2+
3+
export interface GameTopBarProps {
4+
// TODO
5+
}
6+
7+
export const GameTopBar: React.FC<GameTopBarProps> = (
8+
props: GameTopBarProps
9+
): ReactNode => {
10+
return <></>;
11+
};
12+
13+
GameTopBar.displayName = 'GameTopBar';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './game-top-bar';

0 commit comments

Comments
 (0)