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.

4.5 KB
Raw Blame
.ImpersonationNotice {
    --impersonation-notice-border-accent: var(--color-border-warning);

    display: flex;
    width: 26rem;
    background-color: var(--color-bg-surface-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation-3000);
    transition:
        width 200ms cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 150ms ease;

    &--read-only {
        .ImpersonationNotice__sidebar {
            background: var(--warning);
        }

        .ImpersonationNotice__drag-handle {
            color: #fff;
        }

        .ImpersonationNotice__warning-icon {
            color: var(--warning);
        }
    }

    &--login-as {
        .ImpersonationNotice__sidebar {
            background: var(--success);
        }

        .ImpersonationNotice__drag-handle {
            color: #fff;
        }

        .ImpersonationNotice__warning-icon {
            color: var(--success);
        }
    }

    &--read-write {
        --impersonation-notice-border-accent: var(--color-border-error);

        .ImpersonationNotice__sidebar {
            background: var(--danger);
        }

        .ImpersonationNotice__drag-handle {
            color: #fff;
        }

        .ImpersonationNotice__warning-icon {
            color: var(--danger);
        }
    }

    &--dragging {
        cursor: grabbing;
        user-select: none;
        box-shadow:
            var(--shadow-elevation-3000),
            0 8px 24px rgb(0 0 0 / 20%);
    }

    &--minimized {
        width: auto;

        .ImpersonationNotice__sidebar {
            border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
        }
    }

    &__sidebar {
        display: flex;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: 1.5rem;
        cursor: grab;
        user-select: none;
        border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);

        .ImpersonationNotice--dragging & {
            cursor: grabbing;
        }
    }

    &__drag-handle {
        flex-shrink: 0;
    }

    &__minimized-content {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        cursor: pointer;
        animation: ImpersonationNotice__fadeScaleIn 200ms cubic-bezier(0.4, 0, 0.2, 1);

        &:hover {
            background-color: var(--color-bg-surface-secondary);
        }
    }

    &__minimized-icon {
        flex-shrink: 0;
        font-size: 1.25rem;
        transition: transform 150ms ease;

        .ImpersonationNotice__minimized-content:hover & {
            transform: scale(1.1);
        }
    }

    &--login-as &__minimized-icon {
        color: var(--success);
    }

    &--read-only &__minimized-icon {
        color: var(--warning);
    }

    &--read-write &__minimized-icon {
        color: var(--danger);
    }

    &__main {
        flex: 1;
        min-width: 0;
    }

    &__header {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border);
    }

    &__warning-icon {
        flex-shrink: 0;
        font-size: 1.125rem;
        color: var(--text-secondary);
    }

    &__title {
        flex: 1;
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--text-primary);
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }

    &__content {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    &__message {
        margin: 0;
        font-size: 0.8125rem;
        line-height: 1.5;
        color: var(--text-primary);
    }

    &__inline-trigger.LemonButton {
        display: inline-flex;
        min-height: auto;
        font-size: inherit;
        vertical-align: baseline;
    }

    &__user-trigger.LemonButton {
        max-width: 100%;
        font-weight: 600;
        border: 1px solid var(--impersonation-notice-border-accent);
        border-radius: var(--radius);
    }

    &__expiry {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        font-size: var(--text-xs);
        color: var(--color-text-tertiary);

        // Match the refresh icon to the subtle expiry text.
        .LemonButton {
            --lemon-button-color: var(--color-text-tertiary);
        }
    }
}

@keyframes ImpersonationNotice__fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}