cleaned up styles a bit
This commit is contained in:
1 parent
3acbaf576d
commit
451b3638bf
28 files changed
+864
-705
No files matched your search
@@ -0,0 +1,6 @@
|
||||
.MuiButtonBase-root.icon-button[type="button"] {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
max-width: 1.5em;
|
||||
max-height: 1.5em;
|
||||
}
|
||||
@@ -1,30 +1,24 @@
|
||||
import { FC } from 'react';
|
||||
import { IconBaseProps } from './base';
|
||||
import { createAppUseStyles } from 'styles/theme';
|
||||
import "./ButtonIcons.css";
|
||||
import { FC, ReactNode } from "react";
|
||||
import MuiIconButton, { IconButtonTypeMap } from "@mui/material/IconButton";
|
||||
|
||||
export interface ButtonIconStyleProps {
|
||||
}
|
||||
export interface ButtonIconProps extends IconBaseProps, ButtonIconStyleProps {
|
||||
Icon: FC<IconBaseProps>;
|
||||
}
|
||||
const useButtonIconStyles = createAppUseStyles(theme => ({
|
||||
buttonIcon: {
|
||||
borderRadius: "100%",
|
||||
borderWidth: 1,
|
||||
borderStyle: "groove",
|
||||
padding: "0.25em",
|
||||
"&:hover": {
|
||||
backgroundColor: theme.secondaryAccent,
|
||||
cursor: 'pointer',
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
|
||||
export const ButtonIcon: FC<ButtonIconProps> = ({
|
||||
Icon,
|
||||
className,
|
||||
...props
|
||||
}) => <Icon
|
||||
className={`${useButtonIconStyles({}).classes.buttonIcon} ${className}`} {...props}
|
||||
/>
|
||||
export const ButtonIcon: FC<{
|
||||
icon: ReactNode;
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
title?: string;
|
||||
disabled?: boolean;
|
||||
color?: IconButtonTypeMap["props"]["color"];
|
||||
}> = (props) => {
|
||||
return (
|
||||
<MuiIconButton
|
||||
className={["icon-button", props.className ?? ""].join(" ")}
|
||||
onClick={props.onClick}
|
||||
title={props.title}
|
||||
color={props.color}
|
||||
disabled={props.disabled}
|
||||
>
|
||||
{props.icon}
|
||||
</MuiIconButton>
|
||||
);
|
||||
};
|
||||
@@ -1,41 +1,50 @@
|
||||
import { ComponentStory } from "@storybook/react";
|
||||
|
||||
import { IconBase } from "./base";
|
||||
import { PencilIcon, CheckMarkIcon, TrashIcon, InfoIcon, ArrowIcon, AddIcon, ZoomIcon, GearIcon } from ".";
|
||||
import {
|
||||
PencilIcon,
|
||||
CheckMarkIcon,
|
||||
TrashIcon,
|
||||
InfoIcon,
|
||||
ArrowIcon,
|
||||
AddIcon,
|
||||
ZoomIcon,
|
||||
GearIcon,
|
||||
} from ".";
|
||||
import { ButtonIcon } from "./ButtonIcons";
|
||||
import { Page } from "components/Page";
|
||||
|
||||
export default {
|
||||
title: 'Icons',
|
||||
title: "Icons",
|
||||
component: IconBase,
|
||||
};
|
||||
|
||||
|
||||
export const IconList: ComponentStory<typeof IconBase> = (args) => {
|
||||
|
||||
return <Page>
|
||||
<PencilIcon {...args} />
|
||||
<CheckMarkIcon {...args} />
|
||||
<AddIcon {...args} />
|
||||
<TrashIcon {...args} />
|
||||
<InfoIcon {...args} />
|
||||
<ZoomIcon {...args} />
|
||||
<GearIcon {...args} />
|
||||
</Page>
|
||||
}
|
||||
return (
|
||||
<Page>
|
||||
<PencilIcon {...args} />
|
||||
<CheckMarkIcon {...args} />
|
||||
<AddIcon {...args} />
|
||||
<TrashIcon {...args} />
|
||||
<InfoIcon {...args} />
|
||||
<ZoomIcon {...args} />
|
||||
<GearIcon {...args} />
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
IconList.args = {
|
||||
size: 2,
|
||||
color: 'red'
|
||||
}
|
||||
|
||||
color: "red",
|
||||
};
|
||||
|
||||
export const ButtonIconExample: ComponentStory<typeof IconBase> = (args) => {
|
||||
|
||||
return <Page>
|
||||
<ButtonIcon {...args} Icon={ArrowIcon} />
|
||||
</Page>
|
||||
}
|
||||
return (
|
||||
<Page>
|
||||
<ButtonIcon icon={<ArrowIcon {...args} />} />
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
ButtonIconExample.args = {
|
||||
size: 2,
|
||||
color: 'red'
|
||||
}
|
||||
color: "red",
|
||||
};
|
||||
Reference in new issue
Block a user