-
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.
sectionize brick order in prep for proper layout of roof and floor
- Loading branch information
Showing
2 changed files
with
29 additions
and
19 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,30 +1,36 @@ | ||
import { ChakraProvider, Container } from '@chakra-ui/react' | ||
import * as React from 'react' | ||
import { ChakraProvider, Container } from '@chakra-ui/react' | ||
import brickRegistry from './components/Brick/BrickRegistry' | ||
import ErrorBrick from './components/Brick/ErrorBrick' | ||
import theme from './theme' | ||
|
||
export default function App() { | ||
const brickOrder = [ | ||
'char', | ||
'stats', | ||
'gear', | ||
'eff', | ||
'fam', | ||
'debug', | ||
] | ||
|
||
const brickOrder = { | ||
roof: ['character', 'stats', 'gear'], | ||
walls: ['effects', 'debug'], | ||
floor: ['familiar'], | ||
} | ||
const handleBrick = (brickName: string) => { | ||
const CurrBrick = brickRegistry[brickName] | ||
if (CurrBrick === undefined) { | ||
return <ErrorBrick name={brickName} /> | ||
} | ||
return <CurrBrick /> | ||
} | ||
return ( | ||
<ChakraProvider theme={theme}> | ||
<Container maxW="full" p="2px"> | ||
{brickOrder.map((brickName) => { | ||
const CurrBrick = brickRegistry[brickName] | ||
if (CurrBrick === undefined) { | ||
return <ErrorBrick name={brickName} /> | ||
} | ||
return <CurrBrick /> | ||
})} | ||
</Container> | ||
{['roof' as const, 'walls' as const, 'floor' as const].map( | ||
(sectionName) => ( | ||
<Container | ||
maxW="full" | ||
id={`chit_${sectionName}`} | ||
p="2px" | ||
className="chit_chamber" | ||
> | ||
{brickOrder[sectionName].map(handleBrick)} | ||
</Container> | ||
) | ||
)} | ||
</ChakraProvider> | ||
) | ||
} |
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