-
-
Notifications
You must be signed in to change notification settings - Fork 300
/
WithinButtons.tsx
54 lines (49 loc) · 1.41 KB
/
WithinButtons.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { ReactElement, ReactNode } from "react";
import { Typography } from "@react-md/typography";
import AsyncButton, { AsyncButtonProps } from "./AsyncButton";
import Container from "./Container";
import useTemporaryToggle from "./useTemporaryToggle";
interface ExampleProps extends Pick<AsyncButtonProps, "id" | "asyncType"> {
children: ReactNode;
}
function Example({ children, ...props }: ExampleProps): ReactElement {
const { toggled, toggle } = useTemporaryToggle();
return (
<Container>
<Typography type="headline-6" margin="none">
{children}
</Typography>
<AsyncButton {...props} onClick={toggle} loading={toggled} />
<AsyncButton
{...props}
themeType="outline"
onClick={toggle}
loading={toggled}
/>
<AsyncButton
{...props}
themeType="contained"
onClick={toggle}
loading={toggled}
/>
</Container>
);
}
export default function WithinButtons(): ReactElement {
return (
<>
<Example id="async-button-1" asyncType="icon-before">
Circular Before
</Example>
<Example id="async-button-2" asyncType="icon-after">
Circular After
</Example>
<Example id="async-button-3" asyncType="circular-overlay">
Circular Overlay
</Example>
<Example id="async-button-4" asyncType="linear-overlay">
Linear Overlay
</Example>
</>
);
}