import ChevronLeftIcon from "@mui/icons-material/ChevronLeft"; import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import { Button } from "@mui/material"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import { useState } from "react"; function RenderButton({ view }: { view: string }) { return ( ); } const useSwitchView = () => { const list = ["json", "yaml", "rendered"].filter(Boolean); const [view, setView] = useState<(typeof list)[number]>(list[0]); const handleViewChange = () => { setView(list[list.indexOf(view) + 1] || list[0]); }; const renderView = () => { return ( handleViewChange()}> ); }; return { view, renderView, }; }; export default useSwitchView;