Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

818 B
Raw Blame
import { IconArrowDown, IconArrowUp } from 'lib/lemon-ui/icons'

import type { ExperimentMetric } from '~/queries/schema/schema-general'
import { ExperimentMetricGoal } from '~/types'

export type MetricGoalProps = {
    metric: ExperimentMetric
}

export const MetricGoal = ({ metric }: MetricGoalProps): JSX.Element => {
    const goal = metric.goal || ExperimentMetricGoal.Increase
    const isIncrease = goal === ExperimentMetricGoal.Increase
    const Icon = isIncrease ? IconArrowUp : IconArrowDown

    return (
        <div className="flex items-center gap-1 text-xs">
            <span className="text-muted">Goal:</span>
            <Icon className="text-success flex-shrink-0" fontSize="16" />
            <span className="font-semibold">{isIncrease ? 'Increase' : 'Decrease'}</span>
        </div>
    )
}