2019-10-29 16:39:44 +08:00
|
|
|
import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, useContext } from 'react';
|
2020-03-26 18:50:27 +08:00
|
|
|
import { css, cx } from 'emotion';
|
|
|
|
import tinycolor from 'tinycolor2';
|
2020-04-11 22:07:18 +08:00
|
|
|
import { stylesFactory, ThemeContext } from '../../themes';
|
2020-04-10 00:42:59 +08:00
|
|
|
import { IconName } from '../../types/icon';
|
2020-03-26 18:50:27 +08:00
|
|
|
import { getFocusStyle, getPropertiesForButtonSize } from '../Forms/commonStyles';
|
|
|
|
import { GrafanaTheme } from '@grafana/data';
|
2019-10-29 16:39:44 +08:00
|
|
|
import { ButtonContent } from './ButtonContent';
|
2020-03-25 20:10:37 +08:00
|
|
|
import { ComponentSize } from '../../types/size';
|
2020-03-26 18:50:27 +08:00
|
|
|
|
|
|
|
const buttonVariantStyles = (from: string, to: string, textColor: string) => css`
|
|
|
|
background: linear-gradient(180deg, ${from} 0%, ${to} 100%);
|
|
|
|
color: ${textColor};
|
|
|
|
&:hover {
|
|
|
|
background: ${from};
|
|
|
|
color: ${textColor};
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
background: ${from};
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const getPropertiesForVariant = (theme: GrafanaTheme, variant: ButtonVariant) => {
|
|
|
|
switch (variant) {
|
|
|
|
case 'secondary':
|
2020-04-12 21:05:49 +08:00
|
|
|
const from = theme.isLight ? theme.palette.gray7 : theme.palette.gray15;
|
2020-04-11 22:07:18 +08:00
|
|
|
const to = theme.isLight
|
|
|
|
? tinycolor(from)
|
2020-03-26 18:50:27 +08:00
|
|
|
.darken(5)
|
2020-04-11 22:07:18 +08:00
|
|
|
.toString()
|
|
|
|
: tinycolor(from)
|
|
|
|
.lighten(4)
|
|
|
|
.toString();
|
2020-03-26 18:50:27 +08:00
|
|
|
return {
|
2020-04-12 21:05:49 +08:00
|
|
|
borderColor: theme.isLight ? theme.palette.gray85 : theme.palette.gray25,
|
|
|
|
background: buttonVariantStyles(from, to, theme.isLight ? theme.palette.gray25 : theme.palette.gray4),
|
2020-03-26 18:50:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
case 'destructive':
|
|
|
|
return {
|
2020-04-12 21:05:49 +08:00
|
|
|
borderColor: theme.palette.redShade,
|
|
|
|
background: buttonVariantStyles(theme.palette.redBase, theme.palette.redShade, theme.palette.white),
|
2020-03-26 18:50:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
case 'link':
|
|
|
|
return {
|
|
|
|
borderColor: 'transparent',
|
|
|
|
background: buttonVariantStyles('transparent', 'transparent', theme.colors.linkExternal),
|
|
|
|
variantStyles: css`
|
|
|
|
&:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
};
|
|
|
|
case 'primary':
|
|
|
|
default:
|
|
|
|
return {
|
2020-04-14 17:32:14 +08:00
|
|
|
borderColor: theme.colors.bgBlue1,
|
|
|
|
background: buttonVariantStyles(theme.colors.bgBlue1, theme.colors.bgBlue2, theme.palette.white),
|
2020-03-26 18:50:27 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface StyleProps {
|
|
|
|
theme: GrafanaTheme;
|
|
|
|
size: ComponentSize;
|
|
|
|
variant: ButtonVariant;
|
2020-04-19 00:00:54 +08:00
|
|
|
hasIcon: boolean;
|
|
|
|
hasText: boolean;
|
2020-03-26 18:50:27 +08:00
|
|
|
}
|
|
|
|
|
2020-06-18 21:22:57 +08:00
|
|
|
const disabledStyles = css`
|
|
|
|
cursor: not-allowed;
|
|
|
|
opacity: 0.65;
|
|
|
|
box-shadow: none;
|
|
|
|
`;
|
|
|
|
|
2020-04-19 00:00:54 +08:00
|
|
|
export const getButtonStyles = stylesFactory((props: StyleProps) => {
|
|
|
|
const { theme, variant } = props;
|
|
|
|
const { padding, fontSize, height } = getPropertiesForButtonSize(props);
|
2020-03-26 18:50:27 +08:00
|
|
|
const { background, borderColor, variantStyles } = getPropertiesForVariant(theme, variant);
|
|
|
|
|
|
|
|
return {
|
|
|
|
button: cx(
|
|
|
|
css`
|
|
|
|
label: button;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
font-weight: ${theme.typography.weight.semibold};
|
|
|
|
font-family: ${theme.typography.fontFamily.sansSerif};
|
|
|
|
font-size: ${fontSize};
|
|
|
|
padding: ${padding};
|
2020-04-23 00:47:41 +08:00
|
|
|
height: ${height}px;
|
|
|
|
// Deduct border from line-height for perfect vertical centering on windows and linux
|
|
|
|
line-height: ${height - 2}px;
|
2020-03-26 18:50:27 +08:00
|
|
|
vertical-align: middle;
|
|
|
|
cursor: pointer;
|
|
|
|
border: 1px solid ${borderColor};
|
|
|
|
border-radius: ${theme.border.radius.sm};
|
|
|
|
${background};
|
|
|
|
|
|
|
|
&[disabled],
|
|
|
|
&:disabled {
|
2020-06-18 21:22:57 +08:00
|
|
|
${disabledStyles};
|
2020-03-26 18:50:27 +08:00
|
|
|
}
|
|
|
|
`,
|
|
|
|
getFocusStyle(theme),
|
|
|
|
css`
|
|
|
|
${variantStyles}
|
|
|
|
`
|
|
|
|
),
|
|
|
|
// used for buttons with icon only
|
|
|
|
iconButton: css`
|
|
|
|
padding-right: 0;
|
|
|
|
`,
|
|
|
|
iconWrap: css`
|
|
|
|
label: button-icon-wrap;
|
|
|
|
& + * {
|
|
|
|
margin-left: ${theme.spacing.sm};
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
export type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'link';
|
2019-03-27 18:50:36 +08:00
|
|
|
|
2019-10-29 16:39:44 +08:00
|
|
|
type CommonProps = {
|
2020-03-25 20:10:37 +08:00
|
|
|
size?: ComponentSize;
|
2019-10-29 16:39:44 +08:00
|
|
|
variant?: ButtonVariant;
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 20:33:31 +08:00
|
|
|
icon?: IconName;
|
2019-10-29 16:39:44 +08:00
|
|
|
className?: string;
|
|
|
|
};
|
|
|
|
|
2020-03-03 20:04:28 +08:00
|
|
|
export type ButtonProps = CommonProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
2020-01-07 16:20:06 +08:00
|
|
|
|
2020-03-26 18:50:27 +08:00
|
|
|
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
|
({ variant, icon, children, className, ...otherProps }, ref) => {
|
|
|
|
const theme = useContext(ThemeContext);
|
|
|
|
const styles = getButtonStyles({
|
2019-11-01 17:25:44 +08:00
|
|
|
theme,
|
2020-03-26 18:50:27 +08:00
|
|
|
size: otherProps.size || 'md',
|
2019-11-01 17:25:44 +08:00
|
|
|
variant: variant || 'primary',
|
2020-04-19 00:00:54 +08:00
|
|
|
hasText: children !== undefined,
|
|
|
|
hasIcon: icon !== undefined,
|
2019-11-01 17:25:44 +08:00
|
|
|
});
|
2019-10-29 16:39:44 +08:00
|
|
|
|
2020-03-26 18:50:27 +08:00
|
|
|
return (
|
|
|
|
<button className={cx(styles.button, className)} {...otherProps} ref={ref}>
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 20:33:31 +08:00
|
|
|
<ButtonContent icon={icon} size={otherProps.size}>
|
|
|
|
{children}
|
|
|
|
</ButtonContent>
|
2020-03-26 18:50:27 +08:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2020-01-07 16:20:06 +08:00
|
|
|
|
2019-03-27 18:50:36 +08:00
|
|
|
Button.displayName = 'Button';
|
|
|
|
|
2020-04-22 21:46:01 +08:00
|
|
|
type ButtonLinkProps = CommonProps & ButtonHTMLAttributes<HTMLButtonElement> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
2020-03-26 18:50:27 +08:00
|
|
|
export const LinkButton = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
|
2020-06-18 21:22:57 +08:00
|
|
|
({ variant, icon, children, className, disabled, ...otherProps }, ref) => {
|
2020-03-26 18:50:27 +08:00
|
|
|
const theme = useContext(ThemeContext);
|
|
|
|
const styles = getButtonStyles({
|
2019-11-01 17:25:44 +08:00
|
|
|
theme,
|
2020-03-26 18:50:27 +08:00
|
|
|
size: otherProps.size || 'md',
|
2019-11-01 17:25:44 +08:00
|
|
|
variant: variant || 'primary',
|
2020-04-19 00:00:54 +08:00
|
|
|
hasText: children !== undefined,
|
|
|
|
hasIcon: icon !== undefined,
|
2019-11-01 17:25:44 +08:00
|
|
|
});
|
2019-10-29 16:39:44 +08:00
|
|
|
|
2020-06-18 21:22:57 +08:00
|
|
|
const linkButtonStyles =
|
|
|
|
disabled &&
|
|
|
|
cx(
|
|
|
|
disabledStyles,
|
|
|
|
css`
|
|
|
|
pointer-events: none;
|
|
|
|
`
|
|
|
|
);
|
|
|
|
|
2020-03-26 18:50:27 +08:00
|
|
|
return (
|
2020-06-18 21:22:57 +08:00
|
|
|
<a
|
|
|
|
className={cx(styles.button, linkButtonStyles, className)}
|
|
|
|
{...otherProps}
|
|
|
|
ref={ref}
|
|
|
|
tabIndex={disabled ? -1 : 0}
|
|
|
|
>
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 20:33:31 +08:00
|
|
|
<ButtonContent icon={icon} size={otherProps.size}>
|
|
|
|
{children}
|
|
|
|
</ButtonContent>
|
2020-03-26 18:50:27 +08:00
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2019-03-27 18:50:36 +08:00
|
|
|
LinkButton.displayName = 'LinkButton';
|