-
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.
Add node info section, add grid, style footer
- Loading branch information
1 parent
034f46b
commit 5f8913f
Showing
11 changed files
with
151 additions
and
31 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createNode } from '@/models/createNode'; | ||
import React from 'react'; | ||
|
||
export default function Grid() { | ||
const grid = Array.from({ length: 90 * 40 }, (_, index) => createNode(index)); // create the grid | ||
|
||
return ( | ||
<div id="grid"> | ||
{grid.map((node, index) => ( | ||
<div key={node.id} className="grid-node"></div> | ||
))} | ||
</div> | ||
); | ||
} |
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,5 +1,10 @@ | ||
import React from 'react'; | ||
import Grid from '../grid'; | ||
|
||
export default function Main() { | ||
return <main>Grid</main>; | ||
return ( | ||
<main id="main"> | ||
<Grid /> | ||
</main> | ||
); | ||
} |
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,8 @@ | ||
export const createNode = (id: number) => ({ | ||
id, | ||
neighbors: [], | ||
isBarrier: false, | ||
isStart: false, | ||
isEnd: false, | ||
previousNode: undefined, | ||
}); |
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,13 +1,15 @@ | ||
$background: #d1d1d1; | ||
$grid-line-color: rgba(0, 0, 0, 0.4); | ||
|
||
$primary: #fff; | ||
$secondary: #c8c8c8; | ||
$accent: #1ca0ff; | ||
$tertiary: #26324c; | ||
|
||
$openNode: #1cff6b; | ||
$closedNode: #ff1c1c; | ||
$unvisitedNode: #fff; | ||
$visitedNode: #ff1c1c; | ||
$wallNode: #1b1b1b; | ||
$pathNode: #e8ff1c; | ||
$openNode: #1cff6b; | ||
$startNode: #ff1c8e; | ||
$endNode: #331cff; |
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,3 +1,7 @@ | ||
#footer { | ||
margin-top: auto; | ||
display: grid; | ||
place-items: center; | ||
padding: 0.5rem; | ||
background-color: $tertiary; | ||
color: $primary; | ||
} |
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,45 @@ | ||
#info { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: $secondary; | ||
padding: 1rem; | ||
|
||
.node-colors-info { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 3rem; | ||
|
||
.node-info-item { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 0.5rem; | ||
|
||
& > div { | ||
height: 20px; | ||
width: 20px; | ||
} | ||
|
||
#info-wall { | ||
background-color: $wallNode; | ||
} | ||
#info-visited { | ||
background-color: $visitedNode; | ||
} | ||
#info-unvisited { | ||
background-color: $unvisitedNode; | ||
} | ||
#info-path { | ||
background-color: $pathNode; | ||
} | ||
#info-start { | ||
background-color: $startNode; | ||
} | ||
#info-end { | ||
background-color: $endNode; | ||
} | ||
} | ||
} | ||
} |
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,3 +1,19 @@ | ||
#main { | ||
flex-grow: 1; | ||
width: 100%; | ||
display: grid; | ||
place-items: center; | ||
|
||
#grid { | ||
display: grid; | ||
place-items: center; | ||
|
||
grid-template-columns: repeat(90, 1fr); | ||
|
||
.grid-node { | ||
border: 1px solid $grid-line-color; | ||
height: 20px; | ||
width: 20px; | ||
} | ||
} | ||
} |
Empty file.
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,26 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
"compilerOptions": { | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |