Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/netdata-ui",
"version": "2.4.3",
"version": "2.4.4",
"description": "netdata UI kit",
"main": "./lib/index.js",
"files": [
Expand Down
77 changes: 41 additions & 36 deletions src/components/button/IconButton.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Button } from "./button"
import React, { forwardRef } from "react"
import Box from "src/components/templates/box"
import Flex from "src/components/templates/flex"

import React from "react"
import Tooltip from "src/components/drops/tooltip"
import { TextSmall } from "src/components/typography"
import { Button } from "./button"

//this addition here has been done to be aligned with our current implemetation at cloud-frontend src/components/tooltips/customTooltip.js
//this addition here has been done to be aligned with our current implementation at cloud-frontend src/components/tooltips/customTooltip.js

const tooltipBackground = ["neutral", "black"]

Expand All @@ -16,37 +15,43 @@ const CustomTooltipContent = ({ content }) => (
</Flex>
)

const IconButton = ({
iconColor = "nodeBadgeColor",
flavour = "borderless",
icon,
disabled,
onClick,
width = "20px",
height = "20px",
iconSize,
tooltip = "",
...props
}) => {
const isDefaultFlavour = flavour === "default"
return (
<Tooltip plain animation content={tooltip && <CustomTooltipContent content={tooltip} />}>
<Box
cursor="pointer"
iconWidth={width}
iconHeight={height}
onClick={onClick}
as={Button}
flavour={flavour}
disabled={disabled}
icon={icon}
iconColor={isDefaultFlavour ? "white" : iconColor}
iconSize={iconSize}
neutral={!isDefaultFlavour}
{...props}
></Box>
</Tooltip>
)
}
const IconButton = forwardRef(
(
{
iconColor = "nodeBadgeColor",
flavour = "borderless",
icon,
disabled,
onClick,
width = "20px",
height = "20px",
iconSize,
tooltip = "",
...props
},
ref
) => {
const isDefaultFlavour = flavour === "default"
return (
<Tooltip plain animation content={tooltip && <CustomTooltipContent content={tooltip} />}>
<Box
cursor="pointer"
iconWidth={width}
iconHeight={height}
onClick={onClick}
as={Button}
flavour={flavour}
disabled={disabled}
icon={icon}
iconColor={isDefaultFlavour ? "white" : iconColor}
iconSize={iconSize}
neutral={!isDefaultFlavour}
ref={ref}
{...props}
/>
</Tooltip>
)
}
)

export default IconButton
2 changes: 1 addition & 1 deletion src/components/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const TextInput = ({
>
{iconLeft && <LeftIcon icon={iconLeft} />}
<StyledInput
{...props}
disabled={disabled}
placeholder={placeholder}
onBlur={handleBlur}
Expand All @@ -130,6 +129,7 @@ export const TextInput = ({
type="text"
value={value}
ref={inputRef}
{...props}
/>
{iconRight && <RightIcon icon={iconRight} />}
{metaDisplayed && error && <RightIcon icon={<ErrorIcon name="cross_s" />} />}
Expand Down