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.

2.2 KB
Raw Blame
import { Menu, X } from 'lucide-react';
import { t } from '../i18n/t';
import { useTheme } from '../contexts/useTheme.js';
import ServerKitLogo from './ServerKitLogo';
import NotificationBell from './NotificationBell';
import QuickCreate from './QuickCreate';
import { Button as SharedButton } from '@/components/ui/button';

// Fixed header shown only on narrow viewports (< 768px). Houses the
// hamburger toggle that opens the sidebar as an off-canvas drawer, since
// the persistent sidebar is hidden at this width. Hidden on desktop via CSS.
const MobileTopBar = ({ navOpen, onToggle }) => {
    const { whiteLabel } = useTheme();
    const branded = whiteLabel?.enabled;
    const brandName = branded ? (whiteLabel.brandName || 'Brand') : 'ServerKit';
    const showCustomLogo = branded && whiteLabel.logoData && whiteLabel.mode !== 'text_only';

    return (
        <header className="mobile-topbar">
            <SharedButton variant="unstyled"
                type="button"
                className="mobile-topbar__toggle"
                aria-label={navOpen
                    ? t('nav.closeMenu', 'Close navigation menu')
                    : t('nav.openMenu', 'Open navigation menu')}
                aria-expanded={navOpen}
                aria-controls="primary-navigation"
                onClick={onToggle}
            >
                {navOpen ? <X size={22} aria-hidden="true" /> : <Menu size={22} aria-hidden="true" />}
            </SharedButton>
            <div className="mobile-topbar__brand">
                {!branded && (
                    <span className="mobile-topbar__logo">
                        <ServerKitLogo width={26} height={26} />
                    </span>
                )}
                {showCustomLogo && (
                    <span className="mobile-topbar__logo">
                        <img src={whiteLabel.logoData} alt="" />
                    </span>
                )}
                <span className="mobile-topbar__name">{brandName}</span>
            </div>
            <div className="mobile-topbar__actions">
                <QuickCreate />
                <NotificationBell />
            </div>
        </header>
    );
};

export default MobileTopBar;