mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 23:52:20 +08:00
grafana/ui: fix button icon styles (#20084)
Fix spacing and margins in case you use icon only button.
This commit is contained in:
@ -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}>
|
||||
|
Reference in New Issue
Block a user