fixed gallery header issue

This commit is contained in:
Dmitri 2026-04-30 09:01:33 +02:00
parent 6c904a9bb2
commit 917223ad43
3 changed files with 23 additions and 6 deletions

View File

@ -93,12 +93,14 @@ const handleCssPropertyChange = (
'maxHeight', 'maxHeight',
'border', 'border',
'borderRadius', 'borderRadius',
'gap',
]; ];
const getUnit = (p: string) => { const getUnit = (p: string) => {
if (['width', 'minWidth', 'maxWidth'].includes(p)) return 'vw'; if (['width', 'minWidth', 'maxWidth'].includes(p)) return 'vw';
if (['height', 'minHeight', 'maxHeight'].includes(p)) return 'vh'; if (['height', 'minHeight', 'maxHeight'].includes(p)) return 'vh';
if (['border', 'borderRadius'].includes(p)) return 'px'; if (['border', 'borderRadius'].includes(p)) return 'px';
if (p === 'gap') return 'rem';
return ''; return '';
}; };
@ -698,7 +700,7 @@ export function ElementEditorPanel({
maxHeight: extractNumericValue(selectedElement.maxHeight), maxHeight: extractNumericValue(selectedElement.maxHeight),
margin: selectedElement.margin || '', margin: selectedElement.margin || '',
padding: selectedElement.padding || '', padding: selectedElement.padding || '',
gap: selectedElement.gap || '', gap: extractNumericValue(selectedElement.gap),
fontSize: selectedElement.fontSize || '', fontSize: selectedElement.fontSize || '',
lineHeight: selectedElement.lineHeight || '', lineHeight: selectedElement.lineHeight || '',
fontWeight: selectedElement.fontWeight || '', fontWeight: selectedElement.fontWeight || '',

View File

@ -122,12 +122,16 @@ const StyleSettingsSectionCompact: React.FC<StyleSettingsSectionProps> = ({
</div> </div>
<div> <div>
<label className='mb-1 block text-[11px] font-semibold text-gray-600'> <label className='mb-1 block text-[11px] font-semibold text-gray-600'>
Gap Gap (rem)
</label> </label>
<input <input
type='number'
step='0.25'
min='0'
className='w-full rounded border border-gray-300 px-2 py-1 text-xs' className='w-full rounded border border-gray-300 px-2 py-1 text-xs'
value={values.gap || ''} value={values.gap || ''}
onChange={(e) => onChange('gap', e.target.value)} onChange={(e) => onChange('gap', e.target.value)}
placeholder='e.g. 1'
/> />
</div> </div>
<div> <div>

View File

@ -167,15 +167,26 @@ const GalleryElement: React.FC<GalleryElementProps> = ({
{/* Header: image takes priority, otherwise render text */} {/* Header: image takes priority, otherwise render text */}
{/* Header styles (border, borderRadius, dimensions) apply to both image and text modes */} {/* Header styles (border, borderRadius, dimensions) apply to both image and text modes */}
{headerImageUrl ? ( {headerImageUrl ? (
<div style={{ ...headerStyle, padding: 0, overflow: 'hidden' }}> <div
style={{
...headerStyle,
padding: 0,
overflow: 'hidden',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
{/* eslint-disable-next-line @next/next/no-img-element */} {/* eslint-disable-next-line @next/next/no-img-element */}
<img <img
src={resolve(headerImageUrl)} src={resolve(headerImageUrl)}
alt='' alt=''
className='object-cover' className='object-contain'
style={{ style={{
width: '100%', maxWidth: '100%',
height: headerStyle.height || 'auto', maxHeight: '100%',
width: 'auto',
height: 'auto',
}} }}
draggable={false} draggable={false}
/> />