Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added Beta label

Blue Mousee84b20533e92
diff --git a/src/ui/Beta.jsx b/src/ui/Beta.jsx
new file mode 100644
index 000000000..51253dd7b
--- /dev/null
+++ b/src/ui/Beta.jsx
@@ -0,0 +1,31 @@
+import React, { memo } from 'react'
+import PropTypes from 'prop-types'
+import { useTranslation } from 'react-i18next'
+
+import Tooltip from './Tooltip'
+import { WarningPin } from './Pin'
+
+const Beta = ({
+ className,
+}) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <Tooltip
+ tooltipNode={(
+ <WarningPin className={className} label={t('beta.title')} />
+ )}
+ text={t('beta.description')}
+ />
+ )
+}
+
+Beta.propTypes = {
+ className: PropTypes.string,
+}
+
+Beta.defaultProps = {
+ className: '',
+}
+
+export default memo(Beta)
diff --git a/src/ui/Pin.jsx b/src/ui/Pin.jsx
index 9e31139b4..4b0218c17 100644
--- a/src/ui/Pin.jsx
+++ b/src/ui/Pin.jsx
@@ -25,7 +25,7 @@ const InactivePin = ({ label, className }) => (
)
const WarningPin = ({ label, className }) => (
- <p className={cx('px-2 inline-flex text-sm leading-5 font-normal rounded-full bg-yellow-100 text-yellow-600 dark:bg-yellow-300 dark:text-yellow-900', className)}>
+ <p className={cx('px-2 inline-flex text-sm leading-5 font-normal rounded-full bg-yellow-200 text-yellow-800 dark:bg-yellow-300 dark:text-yellow-900', className)}>
{label}
</p>
)
diff --git a/src/ui/Tooltip.jsx b/src/ui/Tooltip.jsx
index 5476f5b7c..816af64d1 100644
--- a/src/ui/Tooltip.jsx
+++ b/src/ui/Tooltip.jsx
@@ -3,9 +3,11 @@ import PropTypes from 'prop-types'
import { QuestionMarkCircleIcon } from '@heroicons/react/solid'
import cx from 'clsx'
-const Tooltip = ({ text, className }) => (
+const Tooltip = ({ text, className, tooltipNode }) => (
<div className={cx('w-5 h-5 relative flex flex-col items-center group', className)}>
- <QuestionMarkCircleIcon className='w-5 h-5 text-gray-700 dark:text-gray-300' />
+ {tooltipNode || (
+ <QuestionMarkCircleIcon className='w-5 h-5 text-gray-700 dark:text-gray-300' />
+ )}
<div className='absolute bottom-0 flex-col items-center hidden mb-6 group-hover:flex'>
<span className='opacity-95 relative w-60 z-10 p-2 text-xs leading-none text-white whitespace-no-wrap bg-gray-700 shadow-lg rounded-md'>
{text}
@@ -20,10 +22,12 @@ Tooltip.propTypes = {
PropTypes.string, PropTypes.number, PropTypes.node,
]).isRequired,
className: PropTypes.string,
+ tooltipNode: PropTypes.node,
}
Tooltip.defaultProps = {
className: '',
+ tooltipNode: null,
}
export default memo(Tooltip)