fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
46 lines
818 B
TypeScript
46 lines
818 B
TypeScript
import { Button as ButtonRAC } from "react-aria-components"
|
|
|
|
import { MaterialIcon } from "../Icons/MaterialIcon"
|
|
import { IconButtonProps } from "./types"
|
|
import { variants } from "./variants"
|
|
|
|
export function IconButton({
|
|
variant,
|
|
emphasis,
|
|
size,
|
|
iconName,
|
|
className,
|
|
...props
|
|
}: IconButtonProps) {
|
|
const classNames = variants({
|
|
variant,
|
|
emphasis,
|
|
size,
|
|
className,
|
|
})
|
|
|
|
return (
|
|
<ButtonRAC {...props} className={classNames}>
|
|
<MaterialIcon
|
|
icon={iconName}
|
|
size={getIconSize(size)}
|
|
color="CurrentColor"
|
|
/>
|
|
</ButtonRAC>
|
|
)
|
|
}
|
|
|
|
function getIconSize(size: IconButtonProps["size"]) {
|
|
switch (size) {
|
|
case "sm":
|
|
return 16
|
|
case "md":
|
|
return 20
|
|
case "xl":
|
|
return 28
|
|
case "lg":
|
|
default:
|
|
return 24
|
|
}
|
|
}
|