Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

1.4 KB
Raw Blame
"use client";

import type { ReactNode } from "react";
import { useState } from "react";
import type { DocsLang } from "@/lib/i18n";

const TOGGLE_LABEL: Record<DocsLang, { less: string; more: string }> = {
  en: { less: "Show fewer databases", more: "Show all databases" },
  cn: { less: "收起数据库列表", more: "展开全部数据库" },
};

export function ExpandableDatabaseGrid({ children, lang }: { children: ReactNode; lang: DocsLang }) {
  const [expanded, setExpanded] = useState(false);
  const label = expanded ? TOGGLE_LABEL[lang].less : TOGGLE_LABEL[lang].more;

  return (
    <>
      <div
        id="landing-database-grid"
        className="landing-database-grid grid grid-cols-9 gap-3 max-[1240px]:grid-cols-7 max-[960px]:grid-cols-5 max-[640px]:grid-cols-4 max-[360px]:grid-cols-3 max-[760px]:gap-2"
        data-expanded={expanded}
      >
        {children}
      </div>
      <button
        type="button"
        className="landing-database-toggle mt-3 hidden min-h-11 w-full items-center justify-center gap-2 rounded-lg border border-landing-line bg-landing-panel px-4 text-sm font-[650] text-landing-ink max-[760px]:flex"
        aria-controls="landing-database-grid"
        aria-expanded={expanded}
        onClick={() => setExpanded((current) => !current)}
      >
        <span>{label}</span>
        <span aria-hidden="true">{expanded ? "−" : "+"}</span>
      </button>
    </>
  );
}