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.

7.5 KB
Raw Blame
@import '../../../../styles/base';

#button-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2147483021;
    color-scheme: light dark;
    user-select: none; // Make the app feel less page-like and more app-like - apps scarcely allow text selection
    opacity: 1;
    transition: opacity ease 0.5s;

    * > {
        ::-webkit-scrollbar {
            width: 0.5rem;
            height: 0.5rem;
        }

        ::-webkit-scrollbar-track {
            background: var(--color-bg-surface-primary);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--trace-3000);
            border-radius: var(--radius);

            &:hover {
                background: var(--muted-3000);
            }
        }
    }

    & + .HedgehogBuddy {
        z-index: 2147483020;
    }

    &[theme='light'] {
        color-scheme: light;
    }

    &[theme='dark'] {
        // override the mark value so that feature flag overrides are visible _and legible_ in dark mode
        --mark: var(--secondary-3000-hover-dark);

        color-scheme: dark;
    }

    & .ReactModalPortal {
        color: var(--text-3000);
    }
}

.ToolbarMenu {
    position: fixed;
    z-index: 2;
    max-width: calc(100% - 2rem);
    height: 0;

    .ToolbarMenu__content {
        position: absolute;
        bottom: 0;
        display: flex;
        flex-direction: column;
        width: 35rem;
        max-height: 0;
        margin-left: -15rem;
        overflow: hidden;
        overflow-y: auto;
        color: var(--text-3000);
        background-color: var(--color-bg-primary);
        filter: drop-shadow(0 5px 10px var(--trace-3000));
        border-radius: var(--radius);
        transition:
            opacity 150ms ease,
            max-height 150ms ease;
    }

    &--visible {
        .ToolbarMenu__content {
            border: 1px solid var(--border-bold-3000);
        }
    }

    &--blurred {
        .ToolbarMenu__content {
            opacity: 0;
        }
    }

    &.ToolbarMenu--below {
        .ToolbarMenu__content {
            top: 0;
            bottom: auto;
        }
    }

    form {
        .form-error {
            color: var(--danger);
        }
    }
}

.Toolbar {
    --toolbar-button-x: 0;
    --toolbar-button-y: 0;
    --toolbar-width-minimized: 40px;
    --toolbar-width-expanded: 334px;
    --toolbar-translate: translate(calc(var(--toolbar-button-x) - 50%), calc(var(--toolbar-button-y) - 50%));

    position: fixed;
    z-index: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;

    // fixed width so that animations work when changing width
    width: var(--toolbar-width-expanded);
    overflow: hidden;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    filter: drop-shadow(0 5px 10px var(--trace-3000));
    border: 1px solid var(--border-bold-3000);
    border-radius: var(--radius);
    transition-timing-function: ease;
    transition-duration: 150ms;
    transition-property: filter, width, transform;
    transform: var(--toolbar-translate);

    > :first-child {
        border-right: 1px solid var(--border-bold-3000);
    }

    > :last-child {
        border-left: 1px solid var(--border-bold-3000);
    }

    &--dragging {
        // Disable transform transition whilst dragging
        transition-property: filter, width;
        transform: var(--toolbar-translate) scale(1.1);
    }

    &--extra-buttons-1 {
        --toolbar-width-expanded: 376px;
    }

    &--extra-buttons-2 {
        --toolbar-width-expanded: 418px;
    }

    &--extra-buttons-3 {
        --toolbar-width-expanded: 460px;
    }

    &--minimized {
        width: var(--toolbar-width-minimized); // Account for border

        &.Toolbar--hedgehog-mode {
            transform: var(--toolbar-translate) scale(0);
        }
    }

    &__logomark {
        width: 1.5rem;
        height: 1.5rem;

        svg {
            width: 100%;
            height: 100%;
        }
    }
}

// Shared modal shell used by both `UiHostConfigModal` (informational: "PostHog could
// not be reached") and `AuthConfirmModal` (security gate before OAuth redirect).
// If you rename or restructure these rules, both components are affected.
//
// Colors here are hard-coded hex values rather than CSS variables on purpose — the
// toolbar renders inside customer websites where `--primary-3000` and friends may
// be overridden by the host page's stylesheet. Hard-coding keeps the modal legible
// regardless of the surrounding CSS.
.UiHostConfigModal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / 50%);

    &__content {
        position: relative;
        width: calc(100vw - 2rem);
        max-width: 36rem;

        // Prevent Cancel/Continue from falling below the fold on short viewports
        // (mobile landscape) when a long uiHost pushes the modal tall.
        max-height: calc(100vh - 2rem);
        padding: 2rem;
        overflow-y: auto;
        font-size: 0.9375rem;
        line-height: 1.6;
        color: #1d1f27;
        user-select: text;
        background: #fff;
        border-radius: 0.75rem;
        box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
    }

    &__branding {
        display: flex;
        justify-content: center;
        margin-bottom: 1.25rem;

        svg {
            width: auto;
            height: 2rem;
        }
    }

    &__header {
        margin-bottom: 0.75rem;
        font-size: 1.0625rem;
        font-weight: 600;
        text-align: center;

        // UiHostConfigModal wraps its title in <strong>; AuthConfirmModal uses an
        // <h2>. Both get the same visual treatment.
        strong {
            font-size: 1.0625rem;
            font-weight: 600;
        }
    }

    &__close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        display: flex;
        align-items: center;
        padding: 0.25rem;
        color: inherit;
        cursor: pointer;
        background: none;
        border: none;
        opacity: 0.6;

        &:hover {
            opacity: 1;
        }
    }

    &__code {
        padding: 0.75rem;
        margin: 0.5rem 0;
        font-size: 0.8rem;
        word-break: break-all;
        white-space: pre-wrap;
        background: #f5f5f5;
        border-radius: 0.25rem;
    }

    &__hint {
        margin-top: 0.5rem;
        font-size: 0.8rem;
        opacity: 0.7;
    }

    p {
        margin: 0.5rem 0;
    }

    code {
        padding: 0.1em 0.3em;
        font-size: 0.85em;
        background: #f5f5f5;
        border-radius: 0.2rem;
    }

    &__button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        border: none;
        border-radius: 0.375rem;

        &:disabled {
            cursor: default;
            opacity: 0.6;
        }

        &--primary {
            color: #fff;
            background: #1d4aff;

            &:hover:not(:disabled) {
                background: #1330bf;
            }
        }

        &--secondary {
            color: #1d1f27;
            background: #e5e7eb;

            &:hover:not(:disabled) {
                background: #d1d5db;
            }
        }
    }
}

[theme='dark'] .UiHostConfigModal {
    &__content {
        color: #e0e0e8;
        background: #2c2d35;
    }

    &__code {
        background: #1d1f27;
    }

    code {
        background: #1d1f27;
    }

    &__button--secondary {
        color: #e0e0e8;
        background: #3c3f47;

        &:hover:not(:disabled) {
            background: #4c4f57;
        }
    }
}