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.

4.6 KB
Raw Blame
// ============================================
// BADGE COMPONENTS
// ============================================

// Badge spec, shared by every legacy badge/pill/tag class here and in
// _status-badge.scss: 20px tall, $radius-badge, 0 $space-tight, $text-xs
// medium. min-height rather than height so a badge never clips its text.
@mixin badge-geometry() {
    display: inline-flex;
    align-items: center;
    min-height: 20px; // geometry: badge height (20px badge spec)
    padding: 0 $space-tight;
    border-radius: $radius-badge;
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    line-height: 1;
    white-space: nowrap;
}

// Status badge

.status-dot {
    @include status-dot(currentColor);
    width: 12px;
    height: 12px;
    border-radius: 50%;

    &.large {
        width: 14px;
        height: 14px;
    }
}

// Status variants
.status-active {
    @include status-variant($success, $success-bg);
    border-color: $success-border;
}

.status-warning {
    @include status-variant($warning, $warning-bg);
    border-color: $warning-border;
}

.status-stopped {
    background: fade($text-tertiary-raw, 10%);
    color: $text-tertiary;
    border-color: fade($text-tertiary-raw, 20%);
}

.status-error {
    @include status-variant($danger, $danger-bg);
    border-color: $danger-border;
}

// App type badge
.app-type {
    @include badge-geometry();
    background: $bg-hover;
}

// SSL badge
.ssl-badge {
    @include badge-geometry();
    gap: $space-1;
    @include status-variant($success, $success-bg);
}

// Active badge (for themes/plugins)
.active-badge {
    @include badge-geometry();
    @include status-variant($success, $success-bg);
}

// Database type badge
.db-type-badge {
    @include badge-geometry();
    gap: $space-1;
    background: $bg-hover;

    &.mysql {
        color: $color-mysql;
    }

    &.postgresql {
        color: $color-postgresql;
    }
}

// Privilege tag
.privilege-tag {
    @include badge-geometry();
    background: $accent-glow;
    color: $accent-primary;
}

// Table name tag
.table-tag {
    background: $bg-hover;
    border: 1px solid $border-subtle;
    @include mono-text();
    @include badge-geometry();
    color: $text-secondary;
}

// Environment badge
.env-badge {
    @include badge-geometry();
    gap: $space-1;
    border: 1px solid transparent;

    &.env-production {
        background: fade($success-raw, 15%);
        color: $success;
        border-color: fade($success-raw, 30%);
    }

    &.env-development {
        background: fade($accent-primary-raw, 15%);
        color: $accent-primary;
        border-color: fade($accent-primary-raw, 30%);
    }

    &.env-staging {
        background: fade($warning-raw, 15%);
        color: $warning;
        border-color: fade($warning-raw, 30%);
    }

    .env-linked-icon {
        opacity: 0.7;
    }
}

// Global Badge Base
.badge {
    @include badge-geometry();
    justify-content: center;
}

.badge-info {
    background-color: fade($info-raw, 15%);
    color: $info;
}

.badge-success {
    background-color: fade($success-raw, 15%);
    color: $success;
}

.badge-error {
    background-color: fade($danger-raw, 15%);
    color: $danger;
}

.badge-warning {
    background-color: fade($warning-raw, 15%);
    color: $warning;
    @include status-variant($warning, $warning-bg);
    border: 1px solid $warning-border;
}

.badge-default {
    background-color: fade($text-tertiary-raw, 15%);
    color: $text-tertiary;
}

[data-slot="badge"] {
    box-sizing: border-box;
    @include badge-geometry();
    justify-content: center;
    gap: $space-1;
    border: 1px solid transparent;
    letter-spacing: 0;
    overflow: visible;
    text-shadow: none;
    box-shadow: none;

    &[data-variant="default"] {
        background: $accent-primary;
        color: white;
        border-color: transparent;
    }

    &[data-variant="secondary"] {
        background: $bg-hover;
        color: $text-primary;
        border-color: $border-active;
    }

    &[data-variant="destructive"] {
        background: $danger;
        color: white;
        border-color: transparent;
    }

    &[data-variant="outline"] {
        background: transparent;
        color: $text-primary;
        border-color: $border-active;
    }

    &[data-variant="success"] {
        @include status-variant($success, $success-bg);
        border-color: $success-border;
    }

    &[data-variant="warning"] {
        @include status-variant($warning, $warning-bg);
        border-color: $warning-border;
    }

    &[data-variant="info"] {
        @include status-variant($info, $info-bg);
        border-color: $info-border;
    }

    &.status-badge-token {
        gap: $space-tight;
    }
}