Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

3.4 KB
Raw Blame
// ============================================
// SPINNER STYLES
// ============================================

.spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    &-sm {
        width: 16px;
        height: 16px;

        .spinner-ring {
            width: 16px;
            height: 16px;
            border-width: 2px;
        }
    }

    &-md {
        width: 24px;
        height: 24px; // geometry: spinner (icon size)

        .spinner-ring {
            width: 24px;
            height: 24px; // geometry: spinner (icon size)
            border-width: 3px;
        }
    }

    &-lg {
        width: 40px;
        height: 40px; // geometry: spinner (icon size)

        .spinner-ring {
            width: 40px;
            height: 40px; // geometry: spinner (icon size)
            border-width: 4px;
        }
    }
}

.spinner-ring {
    border-radius: 50%;
    border-style: solid;
    border-color: fade($accent-primary-raw, 30%);
    border-top-color: $accent-primary;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

// Loading state component
.loading-state {
    min-height: 40vh;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: $space-3;
    padding: $space-10;
    color: $text-secondary;

    span {
        font-size: $text-xs;
    }
}

// Button loading state
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;

    // Button `loading` wraps the label so it can be hidden from assistive
    // tech; `contents` keeps the icon/text gap of the unwrapped label.
    .btn__label { display: contents; }

    // Loading is busy, not unavailable: keep full colour so the button does
    // not read as disabled while the action it started is running.
    &:disabled {
        opacity: 1;
        cursor: progress;
    }

    .spinner {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);

        .spinner-ring {
            border-color: $border-subtle;
            border-top-color: $text-primary;
        }
    }

    &.btn-primary .spinner .spinner-ring {
        border-color: rgba(255, 255, 255, 0.3);
        border-top-color: #fff;
    }

    // Runtime tokens, not the compile-time dark raw: on a light theme the
    // faded light ring disappeared against a white outline button.
    &.btn-secondary .spinner .spinner-ring {
        border-color: $border-default;
        border-top-color: $text-primary;
    }

    &.btn-danger .spinner .spinner-ring {
        border-color: rgba(255, 255, 255, 0.3);
        border-top-color: #fff;
    }
}

.loading {
    // Card roots also set padding; retain the shared loading inset.
    &.uptime-card,
    &.metrics-graph-card { padding: $space-12; }

    @include flex-center();
    min-height: 60vh;
    padding: $space-12;
    color: $text-secondary;
    font-size: $text-xs;
}

.loading-sm {
    color: $text-tertiary;
    font-size: $text-xs;
    padding: $space-4;
}

.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spin {
    animation: spin 1s linear infinite;
}