diff --git a/package.json b/package.json index f415c9a2f..2a52f1704 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netdata/netdata-ui", - "version": "5.0.57", + "version": "5.0.58", "description": "netdata UI kit", "main": "dist/index.js", "module": "dist/es6/index.js", diff --git a/src/components/drops/container.js b/src/components/drops/container.js index 97c8c8f71..6ffd811df 100644 --- a/src/components/drops/container.js +++ b/src/components/drops/container.js @@ -1,33 +1,49 @@ -import React from "react" +import React, { Fragment } from "react" import Flex from "@/components/templates/flex" import { Text } from "@/components/typography" import { Icon } from "@/components/icon" const rotateMap = { right: 1, bottom: 2, left: 3 } +const iconAlignmentProps = { alignSelf: "center" } -const Container = ({ children, align, margin = [1], background = "tooltip", ref, ...rest }) => ( - - - {typeof children === "string" ? {children} : children} +const Container = ({ + children, + align, + margin = [1], + background = "tooltip", + ref, + iconContainerProps = {}, + ...rest +}) => { + const hasIconContainerProps = !!Object.keys(iconContainerProps) + const IconContainer = hasIconContainerProps ? Flex : Fragment + + return ( + + + {typeof children === "string" ? {children} : children} + + {align && ( + + + + )} - {align && ( - - )} - -) + ) +} export default Container