Skip to content

Commit 161b81f

Browse files
committed
Fix #745 item dialog body scaling
1 parent c733c3b commit 161b81f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/components/previews/DialogPreview.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ function DialogBody({ body }: { body: any }) {
7171
console.log(item)
7272
return <div style={`display: flex; gap: ${px(2)}; align-items: center; gap: ${px(4)}`}>
7373
<div style={`width: ${px(b.width ?? 16)}; height: ${px(b.height ?? 16)}`}>
74-
<ItemDisplay item={item} tooltip={b.show_tooltip ?? true} />
74+
<div style={`width: ${px(16)}; height: ${px(16)}`}>
75+
<ItemDisplay item={item} tooltip={b.show_tooltip ?? true} />
76+
</div>
7577
</div>
7678
{b.description && <div style={`max-width: ${px(b.description.width ?? 200)};`}>
7779
<TextComponent component={b.description.contents} />
@@ -230,9 +232,9 @@ function InputControl({ input }: { input: any }) {
230232
}
231233

232234
if (type === 'single_option') {
233-
const firstOption = input.options?.find((o: any) => o.initial) ?? input.options?.[0]
234-
const optionLabel = firstOption?.display ?? firstOption?.id ?? ''
235-
const label = input.label_visible === false ? optionLabel : {translate: 'options.generic_value', with: [input.label ?? '', optionLabel]}
235+
const initial = input.options?.find((o: any) => o.initial) ?? input.options?.[0]
236+
const initialLabel = typeof initial === 'string' ? initial : initial?.display ?? initial?.id ?? ''
237+
const label = input.label_visible === false ? initialLabel : {translate: 'options.generic_value', with: [input.label ?? '', initialLabel]}
236238
return <Button label={label} width={input.width ?? 200} />
237239
}
238240

0 commit comments

Comments
 (0)