diff --git a/src/components/ast/javascript-ast-tree-item.tsx b/src/components/ast/javascript-ast-tree-item.tsx index 3163a32..c4ee0d6 100644 --- a/src/components/ast/javascript-ast-tree-item.tsx +++ b/src/components/ast/javascript-ast-tree-item.tsx @@ -20,12 +20,12 @@ export const JavascriptAstTreeItem: FC = ({ }) => ( {data.type} - +
{Object.entries(data).map(item => ( diff --git a/src/components/ast/json-ast-tree-item.tsx b/src/components/ast/json-ast-tree-item.tsx index 525618a..c42a294 100644 --- a/src/components/ast/json-ast-tree-item.tsx +++ b/src/components/ast/json-ast-tree-item.tsx @@ -22,12 +22,12 @@ export const JsonAstTreeItem: FC = ({ }) => ( {data.type} - +
{Object.entries(data).map(item => ( diff --git a/src/components/ast/markdown-ast-tree-item.tsx b/src/components/ast/markdown-ast-tree-item.tsx index da02d61..1bebf71 100644 --- a/src/components/ast/markdown-ast-tree-item.tsx +++ b/src/components/ast/markdown-ast-tree-item.tsx @@ -22,12 +22,12 @@ export const MarkdownAstTreeItem: FC = ({ }) => ( {data.type} - +
{Object.entries(data).map(item => ( diff --git a/src/components/scope/scope-item.tsx b/src/components/scope/scope-item.tsx index 83f519a..55db5a4 100644 --- a/src/components/scope/scope-item.tsx +++ b/src/components/scope/scope-item.tsx @@ -44,12 +44,12 @@ export const ScopeItem: FC = ({ return ( {isArray && `${Math.max(index, 0)}.`} {key} - +
{properties.map((item, index) => ( = ({ data, path }) => { const [key, value] = data; const [open, setOpen] = useState(false); const Icon = open ? MinusSquareIcon : PlusSquareIcon; - const toggleOpen = () => setOpen(!open); + const isObject = typeof value === "object" && value !== null; + const isExpandable = + isObject && + (Array.isArray(value) + ? value.length > 0 + : Object.keys(value).length > 0); + const values = renderValue(value); + const renderParts = values.map((part, partIndex) => ( + + {part} + + )); return ( <>
- {(typeof value === "object" && - Object.values(value ?? {}).length) || - (Array.isArray(value) && value.length) ? ( + {isExpandable ? ( ) : ( -
+
)} - {key && {key}} - {renderValue(value).map((part, partIndex) => ( - - {part} - - ))} + {key && {key}} + {renderParts}
{open ? ( (({ className, children, ...props }, ref) => (
{children}
diff --git a/tailwind.config.js b/tailwind.config.js index c5d236b..dd91cba 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -75,21 +75,26 @@ module.exports = { }, plugins: [ require("tailwindcss-animate"), - function ({ addUtilities, theme }) { - addUtilities( - { - ".scrollbar-thumb": { - scrollbarColor: `${theme("colors.scrollbar-thumb")} ${theme("colors.scrollbar-track")}`, - }, - ".scrollbar-thumb-hover": { - scrollbarColor: `${theme("colors.scrollbar-thumb-hover")} ${theme("colors.scrollbar-track")}`, - }, - ".scrollbar-track": { - scrollbarWidth: "thin", - }, + function ({ addBase, theme }) { + addBase({ + "::-webkit-scrollbar": { + width: "8px", }, - ["responsive", "hover"], - ); + "::-webkit-scrollbar-thumb": { + backgroundColor: theme("colors.scrollbar-thumb"), + borderRadius: "4px", + }, + "::-webkit-scrollbar-thumb:hover": { + backgroundColor: theme("colors.scrollbar-thumb-hover"), + }, + "::-webkit-scrollbar-track": { + backgroundColor: theme("colors.scrollbar-track"), + }, + "*": { + scrollbarColor: `${theme("colors.scrollbar-thumb")} ${theme("colors.scrollbar-track")}`, + scrollbarWidth: "thin", + }, + }); }, ], purge: {