-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathButton.js
More file actions
30 lines (26 loc) · 617 Bytes
/
Button.js
File metadata and controls
30 lines (26 loc) · 617 Bytes
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
import React, { useContext } from 'react';
import { ButtonThemeContext } from './ButtonThemeProvider';
import { getButtonStyles } from './Button.styles';
const Button = ({
children,
variant = 'primary',
size = 'sm',
active = false,
disabled = false,
...rest
}) => {
const theme = useContext(ButtonThemeContext);
const styles = getButtonStyles({
variant,
size,
active,
disabled,
theme,
});
return (
<button style={styles} disabled={disabled} {...rest}>
{children}
</button>
);
};
export default Button;