mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 19:31:12 +01:00
Fix dialog and invalid variable style
This commit is contained in:
@@ -69,11 +69,7 @@ export function Dialog({
|
||||
animate={{ top: 0, scale: 1 }}
|
||||
className={classNames(
|
||||
className,
|
||||
'grid',
|
||||
title != null && description != null && 'grid-rows-[auto_minmax(0,1fr)_minmax_(0,1fr)]',
|
||||
title == null && description != null && 'grid-rows-[auto_minmax(0,1fr)]',
|
||||
title != null && description == null && 'grid-rows-[auto_minmax(0,1fr)]',
|
||||
title == null && description == null && 'grid-rows-[minmax(0,1fr)]',
|
||||
'grid grid-rows-[auto_auto_minmax(0,1fr)]',
|
||||
'grid-cols-1', // must be here for inline code blocks to correctly break words
|
||||
'relative bg-surface pointer-events-auto',
|
||||
'rounded-lg',
|
||||
@@ -87,16 +83,20 @@ export function Dialog({
|
||||
size === 'dynamic' && 'min-w-[20rem] max-w-[100vw]',
|
||||
)}
|
||||
>
|
||||
{title && (
|
||||
{title ? (
|
||||
<Heading className="px-6 mt-4 mb-2" level={1} id={titleId}>
|
||||
{title}
|
||||
</Heading>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
|
||||
{description && (
|
||||
{description ? (
|
||||
<div className="min-h-0 px-6 text-text-subtle mb-3" id={descriptionId}>
|
||||
{description}
|
||||
</div>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
|
||||
<div
|
||||
|
||||
@@ -106,20 +106,19 @@ function templateTags(
|
||||
};
|
||||
}
|
||||
|
||||
let invalid = false;
|
||||
if (option.type === 'function') {
|
||||
const tokens = parseTemplate(rawTag);
|
||||
const values = collectArgumentValues(tokens, option);
|
||||
for (const arg of option.args) {
|
||||
if (!('optional' in arg)) continue;
|
||||
if (!arg.optional && values[arg.name] == null) {
|
||||
invalid = true;
|
||||
option.invalid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const widget = new TemplateTagWidget({ ...option, invalid }, rawTag, node.from);
|
||||
const widget = new TemplateTagWidget(option, rawTag, node.from);
|
||||
const deco = Decoration.replace({ widget, inclusive: true });
|
||||
widgets.push(deco.range(node.from, node.to));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user