-
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.
Merge pull request #8 from sky-ash/fix-3d-path-buttons
Fix 3D path buttons and sprite
- Loading branch information
Showing
2 changed files
with
24 additions
and
47 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,64 +1,57 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Box, Fab, Button, IconButton, AppBar, Toolbar } from '@mui/material'; | ||
import { useLocation, Link } from 'react-router-dom'; | ||
import React from 'react'; | ||
import { Box, Fab, IconButton, AppBar, Toolbar } from '@mui/material'; | ||
import { Link } from 'react-router-dom'; | ||
import SettingsIcon from '@mui/icons-material/Settings'; | ||
import HomeIcon from '@mui/icons-material/Home'; | ||
import AppsIcon from '@mui/icons-material/Apps'; | ||
|
||
export default function Navigation() { | ||
const [spritePosition, setSpritePosition] = useState({ x: 0, y: 0 }); | ||
|
||
const moveSprite = (x, y) => { | ||
setSpritePosition({ x, y }); | ||
}; | ||
|
||
return ( | ||
<AppBar position="fixed" | ||
bgcolor="background.paper" | ||
p={2} | ||
sx={{ top: 'auto', | ||
bottom: 0, | ||
backgroundColor: 'background.paper', | ||
boxShadow: 'none' // P388d | ||
}}> | ||
|
||
<Link to="/path"> | ||
<Fab color="primary" | ||
sx={{ position: 'absolute', zIndex: 1, | ||
margin: '0 auto', top: -20, | ||
left: 0, right: 0, }}> | ||
left: 0, right: 0, | ||
backgroundColor: 'primary.main', // Pbfd8 | ||
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', // P1e56 | ||
borderRadius: '8px' // P1e56 | ||
}}> | ||
<AppsIcon /> | ||
</Fab> | ||
</Link> | ||
|
||
<Toolbar> | ||
|
||
<Link to="/" sx={{alignItems: 'flex-start'}}> | ||
<IconButton color="primary"> | ||
<Link to="/"> | ||
<IconButton color="primary" | ||
sx={{ backgroundColor: 'primary.main', // Pbfd8 | ||
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', // P1e56 | ||
borderRadius: '8px' // P1e56 | ||
}}> | ||
<HomeIcon /> | ||
</IconButton> | ||
</Link> | ||
|
||
<Box sx={{flexGrow: 1}} /> | ||
|
||
<Link to="/settings" sx={{alignItems: 'flex-end'}}> | ||
<IconButton color="primary"> | ||
<Link to="/settings"> | ||
<IconButton color="primary" | ||
sx={{ backgroundColor: 'primary.main', // Pbfd8 | ||
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', // P1e56 | ||
borderRadius: '8px' // P1e56 | ||
}}> | ||
<SettingsIcon /> | ||
</IconButton> | ||
</Link> | ||
|
||
</Toolbar> | ||
|
||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
top: `${spritePosition.y}%`, | ||
left: `${spritePosition.x}%`, | ||
width: '30px', | ||
height: '30px', | ||
backgroundColor: 'red', | ||
borderRadius: '50%', | ||
transition: 'top 0.5s, left 0.5s', | ||
}} | ||
/> | ||
</AppBar> | ||
); | ||
} |
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