import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2020-2025 GoodData Corporation
/**
 * Utility component for displaying a code snippet of a component with its props.
 *
 * @internal
 */
export function CodeSnippet({ componentName, componentProps, }) {
    const renderProp = (key, value) => {
        if (typeof value === "string") {
            return `${key}="${value}"`;
        }
        return `${key}={${value}}`;
    };
    const propList = Object.entries(componentProps).map(([key, value]) => renderProp(key, value));
    return (_jsx("div", { style: {
            backgroundColor: "#fefefe",
            borderRadius: 3,
            border: "1px solid #ddd",
            padding: 10,
        }, children: _jsx("code", { style: {
                whiteSpace: "pre",
                fontSize: 10,
                width: "100%",
                display: "block",
                lineHeight: "18px",
                overflow: "hidden",
            }, children: `<${componentName}
    ${propList.join("\n    ")}
/>` }) }));
}
