grafana/ui: fix button icon styles (#20084)

Fix spacing and margins in case you use icon only button.
This commit is contained in:
Andrej Ocenas
2019-11-01 10:25:44 +01:00
committed by GitHub
parent a5e8e0e291
commit 6dde81d839
7 changed files with 50 additions and 47 deletions

View File

@ -24,8 +24,13 @@ export const Button: React.FunctionComponent<ButtonProps> = props => {
// Default this to 'button', otherwise html defaults to 'submit' which then submits any form it is in.
buttonProps.type = buttonProps.type || 'button';
const styles =
stylesProp || getButtonStyles({ theme, size: size || 'md', variant: variant || 'primary', withIcon: !!icon });
const styles: ButtonStyles =
stylesProp ||
getButtonStyles({
theme,
size: size || 'md',
variant: variant || 'primary',
});
return (
<button className={cx(styles.button, className)} {...buttonProps}>
@ -46,8 +51,13 @@ type LinkButtonProps = CommonProps &
export const LinkButton: React.FunctionComponent<LinkButtonProps> = props => {
const theme = useContext(ThemeContext);
const { size, variant, icon, children, className, styles: stylesProp, ...anchorProps } = props;
const styles =
stylesProp || getButtonStyles({ theme, size: size || 'md', variant: variant || 'primary', withIcon: !!icon });
const styles: ButtonStyles =
stylesProp ||
getButtonStyles({
theme,
size: size || 'md',
variant: variant || 'primary',
});
return (
<a className={cx(styles.button, className)} {...anchorProps}>