Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@docusaurus/preset-classic": "3.9.2",
"@mdx-js/react": "3.1.1",
"clsx": "2.1.1",
"lucide-react": "^1.14.0",
"prism-react-renderer": "2.4.1",
"react": "18.3.1",
"react-dom": "18.3.1"
Expand Down
4 changes: 3 additions & 1 deletion src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@
}

.membrane-card__icon {
display: inline-flex;
flex: 0 0 auto;
color: var(--ifm-color-primary);
font-size: 1.1rem;
line-height: 1;
}

@media (max-width: 720px) {
Expand Down
69 changes: 68 additions & 1 deletion src/theme/MDXComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@ import Link from "@docusaurus/Link";
import OriginalMDXComponents from "@theme-original/MDXComponents";
import DocusaurusTabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import {
ArrowDownToLine,
Bolt,
BookOpen,
Brain,
ChartBar,
ChartLine,
ChartScatter,
Clock,
Code,
Database,
Info as InfoIcon,
Layers,
ListOrdered,
Lock,
Network,
Pencil,
Rocket,
Search,
Server,
Shield,
Sparkles,
VectorSquare,
} from "lucide-react";

const CARD_ICONS = {
"arrow-down-to-line": ArrowDownToLine,
"book-open": BookOpen,
"chart-bar": ChartBar,
"chart-line": ChartLine,
"chart-scatter": ChartScatter,
"circle-info": InfoIcon,
"list-ordered": ListOrdered,
"magnifying-glass": Search,
"vector-square": VectorSquare,
bolt: Bolt,
brain: Brain,
clock: Clock,
code: Code,
database: Database,
layers: Layers,
lock: Lock,
pencil: Pencil,
rocket: Rocket,
server: Server,
shield: Shield,
sitemap: Network,
sparkles: Sparkles,
};

function Field({ kind, path, name, type, required, children, default: defaultValue }) {
const label = path ?? name;
Expand Down Expand Up @@ -122,11 +171,29 @@ function CardGroup({ children, cols = 2 }) {
);
}

function CardIcon({ icon }) {
if (!icon) {
return null;
}
if (React.isValidElement(icon)) {
return <span className="membrane-card__icon" aria-hidden="true">{icon}</span>;
}
const Icon = typeof icon === "string" ? CARD_ICONS[icon] : null;
if (!Icon) {
return null;
}
return (
<span className="membrane-card__icon" aria-hidden="true">
<Icon size={20} strokeWidth={2} />
</span>
);
}

function Card({ title, icon, href, children }) {
const body = (
<div className="membrane-card">
<div className="membrane-card__header">
{icon ? <span className="membrane-card__icon" aria-hidden="true">{icon}</span> : null}
<CardIcon icon={icon} />
{title ? <strong>{title}</strong> : null}
</div>
<div className="membrane-card__body">{children}</div>
Expand Down
Loading