-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/redesign-synthesis
- Loading branch information
Showing
78 changed files
with
1,992 additions
and
904 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
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
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
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
43 changes: 43 additions & 0 deletions
43
packages/client/src/modules/common/components/Button/Button.tsx
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Button as ButtonLib, CircularProgress } from "@mui/material"; | ||
import { useMemo } from "react"; | ||
|
||
export { Button }; | ||
|
||
interface ButtonProps { | ||
type?: "primary" | "secondary"; | ||
loading?: boolean; | ||
onClick: () => void | Promise<void>; | ||
children: React.ReactNode; | ||
} | ||
|
||
function Button({ | ||
type = "primary", | ||
loading = false, | ||
onClick, | ||
children, | ||
}: ButtonProps) { | ||
const buttonProps = useMemo(() => { | ||
if (type === "primary") { | ||
return { | ||
color: "secondary", | ||
variant: "contained", | ||
}; | ||
} | ||
return { | ||
color: "primary", | ||
}; | ||
}, [type]); | ||
const loaderColor = useMemo( | ||
() => (type === "primary" ? "primary" : "secondary"), | ||
[type] | ||
); | ||
|
||
return ( | ||
<ButtonLib {...(buttonProps as any)} disabled={loading} onClick={onClick}> | ||
{loading && ( | ||
<CircularProgress color={loaderColor} size={16} sx={{ mr: 1 }} /> | ||
)} | ||
{children} | ||
</ButtonLib> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Button } from "./Button"; |
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
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
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
Oops, something went wrong.