mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
style
This commit is contained in:
parent
1b6d81f4e0
commit
744f0ed852
1 changed files with 8 additions and 8 deletions
|
|
@ -688,8 +688,8 @@ const ToolHeaderComponent = ({
|
|||
|
||||
const [isExpanded, setIsExpanded] = useState(false);
|
||||
|
||||
const isDropdown = !!children
|
||||
const isClickable = !!isDropdown || !!onClick
|
||||
const isDropdown = children !== undefined // null ALLOWS dropdown
|
||||
const isClickable = !!(isDropdown || onClick)
|
||||
|
||||
return (<div className=''>
|
||||
<div className="border border-void-border-3 rounded px-2 py-1 bg-void-bg-2-alt overflow-hidden">
|
||||
|
|
@ -698,7 +698,7 @@ const ToolHeaderComponent = ({
|
|||
<div
|
||||
className={`select-none flex items-center min-h-[24px] ${isClickable ? 'cursor-pointer hover:brightness-125 transition-all duration-150' : ''} ${!isDropdown ? 'mx-1' : ''}`}
|
||||
onClick={() => {
|
||||
if (children) { setIsExpanded(v => !v); }
|
||||
if (isDropdown) { setIsExpanded(v => !v); }
|
||||
if (onClick) { onClick(); }
|
||||
}}
|
||||
>
|
||||
|
|
@ -726,12 +726,12 @@ const ToolHeaderComponent = ({
|
|||
</div>
|
||||
</div>
|
||||
{/* children */}
|
||||
{children && <div
|
||||
{<div
|
||||
// the py-1 here makes sure all elements in the container have py-2 total. this makes a nice animation effect during transition.
|
||||
className={`overflow-hidden transition-all duration-200 ease-in-out ${isExpanded ? 'opacity-100 py-1' : 'max-h-0 opacity-0'}`}
|
||||
>
|
||||
<div className="text-void-fg-4 px-2 py-1 bg-black bg-opacity-20 border border-void-border-4 border-opacity-50 rounded-sm">
|
||||
{children}
|
||||
{children || '(no results)'}
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
|
|
@ -1166,7 +1166,7 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
if (toolMessage.result.type !== 'error') {
|
||||
const { value, params } = toolMessage.result
|
||||
componentParams.numResults = value.children?.length
|
||||
componentParams.children = <>
|
||||
componentParams.children = (value.children?.length ?? 0) === 0 ? null : <>
|
||||
{value.children?.map((child, i) => (
|
||||
<div
|
||||
key={i}
|
||||
|
|
@ -1213,7 +1213,7 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
if (toolMessage.result.type !== 'error') {
|
||||
const { value, params } = toolMessage.result
|
||||
componentParams.numResults = value.uris.length
|
||||
componentParams.children = <>
|
||||
componentParams.children = value.uris.length === 0 ? null : <>
|
||||
{value.uris.map((uri, i) => (
|
||||
<div
|
||||
key={i}
|
||||
|
|
@ -1259,7 +1259,7 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
if (toolMessage.result.type !== 'error') {
|
||||
const { value, params } = toolMessage.result
|
||||
componentParams.numResults = value.uris.length
|
||||
componentParams.children = <>
|
||||
componentParams.children = value.uris.length === 0 ? null : <>
|
||||
{value.uris.map((uri, i) => (
|
||||
<div key={i}
|
||||
className="hover:brightness-125 hover:cursor-pointer transition-all duration-200 flex items-center flex-nowrap"
|
||||
|
|
|
|||
Loading…
Reference in a new issue