UNPKG

@grafana/ui

Version:
1 lines 2.21 kB
{"version":3,"file":"FeatureInfoBox.mjs","sources":["../../../../src/components/InfoBox/FeatureInfoBox.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport { memo, forwardRef } from 'react';\n\nimport { FeatureState, GrafanaTheme2 } from '@grafana/data';\n\nimport { useStyles2 } from '../../themes/ThemeContext';\nimport { FeatureBadge } from '../FeatureBadge/FeatureBadge';\n\nimport { InfoBox, InfoBoxProps } from './InfoBox';\n\nexport interface FeatureInfoBoxProps extends Omit<InfoBoxProps, 'title' | 'urlTitle'> {\n title: string;\n featureState?: FeatureState;\n}\n\n/** @deprecated use Alert with severity info */\nexport const FeatureInfoBox = memo(\n forwardRef<HTMLDivElement, FeatureInfoBoxProps>(({ title, featureState, ...otherProps }, ref) => {\n const styles = useStyles2(getFeatureInfoBoxStyles);\n\n const titleEl = featureState ? (\n <>\n <div className={styles.badge}>\n <FeatureBadge featureState={featureState} />\n </div>\n <h3>{title}</h3>\n </>\n ) : (\n <h3>{title}</h3>\n );\n return <InfoBox branded title={titleEl} urlTitle=\"Read documentation\" ref={ref} {...otherProps} />;\n })\n);\n\nFeatureInfoBox.displayName = 'FeatureInfoBox';\n\nconst getFeatureInfoBoxStyles = (theme: GrafanaTheme2) => {\n return {\n badge: css({\n marginBottom: theme.spacing(1),\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;AAgBO,MAAM,cAAiB,GAAA,IAAA;AAAA,EAC5B,UAAA,CAAgD,CAAC,EAAE,KAAA,EAAO,cAAc,GAAG,UAAA,IAAc,GAAQ,KAAA;AAC/F,IAAM,MAAA,MAAA,GAAS,WAAW,uBAAuB,CAAA;AAEjD,IAAM,MAAA,OAAA,GAAU,+BAEZ,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,SAAI,SAAW,EAAA,MAAA,CAAO,OACrB,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,cAA4B,CAC5C,EAAA,CAAA;AAAA,sBACA,GAAA,CAAC,QAAI,QAAM,EAAA,KAAA,EAAA;AAAA,KACb,EAAA,CAAA,mBAEC,GAAA,CAAA,IAAA,EAAA,EAAI,QAAM,EAAA,KAAA,EAAA,CAAA;AAEb,IAAO,uBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,OAAA,EAAO,IAAC,EAAA,KAAA,EAAO,SAAS,QAAS,EAAA,oBAAA,EAAqB,GAAW,EAAA,GAAG,UAAY,EAAA,CAAA;AAAA,GACjG;AACH;AAEA,cAAA,CAAe,WAAc,GAAA,gBAAA;AAE7B,MAAM,uBAAA,GAA0B,CAAC,KAAyB,KAAA;AACxD,EAAO,OAAA;AAAA,IACL,OAAO,GAAI,CAAA;AAAA,MACT,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KAC9B;AAAA,GACH;AACF,CAAA;;;;"}