Explorer V2 (#5548)
* remove pnpm lock file (should only be using yarn) * Add lefthook configuration for pre-commit checks * Add explorer-v2 to package.json dependencies * add explorer v2 * update explorer v2 package name * + basepath + redirect to basepath + blog icons refactor + icons refactor * Add Getting Started instructions to README * fix noise graph bug and line graph UI * Delete unused translations, clean up console logs * / test image url * update yarn.lock --------- Co-authored-by: RadekSabacky <radek@nymtech.net> Co-authored-by: windy-ux <75579979+windy-ux@users.noreply.github.com> Co-authored-by: Yana <iana.matrosova@gmail.com> Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
"use client";
|
||||
import { Button, ButtonGroup, CircularProgress } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { Link } from "../muiLink";
|
||||
|
||||
type Option = {
|
||||
label: string;
|
||||
isSelected: boolean;
|
||||
link: string;
|
||||
};
|
||||
|
||||
type Options = [Option, Option];
|
||||
|
||||
const ExplorerButtonGroup = ({
|
||||
size = "small",
|
||||
options,
|
||||
onPage,
|
||||
}: {
|
||||
size?: "small" | "medium" | "large";
|
||||
options: Options;
|
||||
onPage: string;
|
||||
}) => {
|
||||
const [loading, setLoading] = useState<string | null>(null);
|
||||
const handleClick = (label: string) => {
|
||||
if (onPage === label) return;
|
||||
setLoading(label);
|
||||
};
|
||||
return (
|
||||
<ButtonGroup size={size}>
|
||||
{options.map((option) => (
|
||||
<Link
|
||||
href={option.link}
|
||||
key={option.label}
|
||||
sx={{ textDecoration: "none" }}
|
||||
onClick={() => handleClick(option.label)}
|
||||
>
|
||||
<Button
|
||||
sx={{
|
||||
color: option.isSelected
|
||||
? "primary.contrastText"
|
||||
: "text.primary",
|
||||
"&:hover": {
|
||||
bgcolor: option.isSelected ? "primary.main" : "",
|
||||
},
|
||||
bgcolor: option.isSelected ? "primary.main" : "transparent",
|
||||
}}
|
||||
variant="outlined"
|
||||
>
|
||||
{loading === option.label ? (
|
||||
<CircularProgress size={18} color="inherit" />
|
||||
) : (
|
||||
option.label
|
||||
)}
|
||||
</Button>
|
||||
</Link>
|
||||
))}
|
||||
</ButtonGroup>
|
||||
);
|
||||
};
|
||||
export default ExplorerButtonGroup;
|
||||
Reference in New Issue
Block a user