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.

2.7 KB
Raw Blame
.SampleDataState {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 6rem;

    &__tag {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        z-index: 1;
    }

    &__viz {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        min-height: 0;
        overflow: hidden;
        transition: opacity 0.3s ease;
        animation: SampleDataState__breathe 5s ease-in-out infinite;

        // Settle to full opacity while the user is interacting with the chart
        &:hover {
            opacity: 1;
            animation: none;
        }
    }

    &__viz--custom {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding-top: 2rem;
    }

    &__chart {
        // The quill chart root stretches via flex-1, so it needs a flex column parent
        display: flex;
        flex-direction: column;
        align-self: stretch;
        width: 100%;

        // The chart is a picture of made-up data, so it answers nothing the pointer asks of it.
        // Hover still reaches __viz, which owns the settle-to-full-opacity effect.
        pointer-events: none;

        // The hidden start comes from the keyframe plus `both`, never a declared `opacity: 0` -
        // that would leave the placeholder invisible forever if the animation never runs
        animation: SampleDataState__fade-up 0.7s cubic-bezier(0.25, 0.1, 0.25, 1) both;
    }

    &__row {
        animation: SampleDataState__fade-up 0.5s ease-out both;
    }

    &__row-cell {
        height: 0.5rem;
        background: var(--color-skeleton-light);
        border-radius: 0.25rem;
    }

    &__number {
        animation: SampleDataState__fade-up 0.7s cubic-bezier(0.25, 0.1, 0.25, 1) both;
    }

    // Reduced motion and screenshot tests get no animation at all. A zero-duration animation is not
    // enough, because headless Chromium in CI can paint its 0% keyframe, which hides the placeholder.
    &--static &__viz,
    &--static &__chart,
    &--static &__row,
    &--static &__number {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .SampleDataState__viz,
    .SampleDataState__chart,
    .SampleDataState__row,
    .SampleDataState__number {
        animation: none;
    }
}

@keyframes SampleDataState__fade-up {
    from {
        opacity: 0;
        transform: translateY(0.375rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes SampleDataState__breathe {
    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.55;
    }
}