move instructions to sidebar menu

This commit is contained in:
Ole Morud
2022-08-22 16:13:28 +02:00
parent 6bd184ac5b
commit c14b29305c

View File

@@ -1,7 +1,8 @@
import { Card, CardContent, styled, Typography } from "@mui/material" import { Card, CardContent, Grid, styled, Typography } from "@mui/material"
import React from "react" import React from "react"
import instructions, { Instruction } from "../Instructions" import instructions, { Instruction } from "../Instructions"
import Tooltip, { TooltipProps, tooltipClasses } from "@mui/material/Tooltip" import Tooltip, { TooltipProps, tooltipClasses } from "@mui/material/Tooltip"
import { SIDEBAR_WIDTH } from "../const"
const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => ( const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} /> <Tooltip {...props} classes={{ popper: className }} />
@@ -15,6 +16,16 @@ const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => (
} }
})) }))
const sideBar: React.CSSProperties = {
height: "100%",
position: "fixed",
backgroundColor: "#999999",
//overflowX: "hidden",
paddingTop: "30px",
width: `${SIDEBAR_WIDTH}rem`,
justifyContent: "center"
}
function handleDragStart( function handleDragStart(
instruction: Instruction, instruction: Instruction,
event: React.DragEvent<HTMLDivElement> | undefined event: React.DragEvent<HTMLDivElement> | undefined
@@ -32,11 +43,11 @@ export default function InstructionMenu() {
let key = 0 let key = 0
return ( return (
<> <div style={sideBar}>
<div style={{ display: "flex" }}> <Grid container columns={2}>
{instructions.map((instruction: Instruction) => { {instructions.map((instruction: Instruction) => {
return ( return (
<div key={key++}> <Grid item key={key++} xs={1}>
<HtmlTooltip <HtmlTooltip
key={key++} key={key++}
title={ title={
@@ -53,10 +64,10 @@ export default function InstructionMenu() {
</Card> </Card>
</div> </div>
</HtmlTooltip> </HtmlTooltip>
</div> </Grid>
) )
})} })}
</div> </Grid>
</> </div>
) )
} }