From 0f709cffbc41aac33e4974cb67892a693ab22cca Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Wed, 6 Nov 2019 17:28:41 +0100 Subject: [PATCH] Fix when only icon is present (#20208) --- .../src/components/Button/ButtonContent.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/grafana-ui/src/components/Button/ButtonContent.tsx b/packages/grafana-ui/src/components/Button/ButtonContent.tsx index 75ec567b6a9..70ea9d6bf5b 100644 --- a/packages/grafana-ui/src/components/Button/ButtonContent.tsx +++ b/packages/grafana-ui/src/components/Button/ButtonContent.tsx @@ -18,13 +18,22 @@ type Props = { export function ButtonContent(props: Props) { const { icon, className, iconClassName, children } = props; const styles = getStyles(); - return icon ? ( - - -     - {children} - - ) : ( - {children} - ); + if (icon && children) { + return ( + + +     + {children} + + ); + } + if (icon) { + return ( + + + + ); + } + + return {children}; }