noogle/components/functionItem/functionItem.tsx

43 lines
895 B
TypeScript
Raw Normal View History

2022-11-26 12:36:08 +03:00
import {
Box,
Card,
ListItemText,
Paper,
Stack,
Typography,
} from "@mui/material";
interface FunctionItemProps {
selected: boolean;
name: String;
info: {
"attr-path": String;
source: String;
from: String;
to: String;
};
}
export default function FunctionItem(props: FunctionItemProps) {
const { name, info, selected } = props;
return (
<Paper
elevation={0}
sx={{
display: "flex",
justifyContent: "left",
2022-11-27 16:16:52 +03:00
px: 2,
py: 1,
2022-11-26 12:36:08 +03:00
color: selected ? "primary.main" : undefined,
borderColor: selected ? "action.selected" : "none",
borderWidth: 1,
borderStyle: selected ? "solid" : "none",
}}
>
<Stack>
<ListItemText primary={name} secondary={info["attr-path"]} />
<Typography>{`${info.from} -> ${info.to} `}</Typography>
</Stack>
</Paper>
);
}