gallery header improvement
This commit is contained in:
parent
d2067f1770
commit
73f524dab3
@ -495,6 +495,9 @@ export function ElementEditorPanel({
|
|||||||
galleryHeaderImageUrl={
|
galleryHeaderImageUrl={
|
||||||
selectedElement.galleryHeaderImageUrl || ''
|
selectedElement.galleryHeaderImageUrl || ''
|
||||||
}
|
}
|
||||||
|
galleryHeaderText={
|
||||||
|
selectedElement.galleryHeaderText || ''
|
||||||
|
}
|
||||||
galleryTitle={selectedElement.galleryTitle || ''}
|
galleryTitle={selectedElement.galleryTitle || ''}
|
||||||
galleryInfoSpans={
|
galleryInfoSpans={
|
||||||
selectedElement.galleryInfoSpans || []
|
selectedElement.galleryInfoSpans || []
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { FONT_OPTIONS } from '../../lib/fonts';
|
|||||||
interface GallerySettingsSectionCompactProps {
|
interface GallerySettingsSectionCompactProps {
|
||||||
// Header settings
|
// Header settings
|
||||||
galleryHeaderImageUrl: string;
|
galleryHeaderImageUrl: string;
|
||||||
|
galleryHeaderText: string;
|
||||||
galleryTitle: string;
|
galleryTitle: string;
|
||||||
galleryInfoSpans: GalleryInfoSpan[];
|
galleryInfoSpans: GalleryInfoSpan[];
|
||||||
galleryColumns: number;
|
galleryColumns: number;
|
||||||
@ -29,6 +30,7 @@ interface GallerySettingsSectionCompactProps {
|
|||||||
// Header handlers
|
// Header handlers
|
||||||
onUpdateHeader: (patch: {
|
onUpdateHeader: (patch: {
|
||||||
galleryHeaderImageUrl?: string;
|
galleryHeaderImageUrl?: string;
|
||||||
|
galleryHeaderText?: string;
|
||||||
galleryTitle?: string;
|
galleryTitle?: string;
|
||||||
galleryColumns?: number;
|
galleryColumns?: number;
|
||||||
galleryTitleFontFamily?: string;
|
galleryTitleFontFamily?: string;
|
||||||
@ -47,6 +49,7 @@ const GallerySettingsSectionCompact: React.FC<
|
|||||||
GallerySettingsSectionCompactProps
|
GallerySettingsSectionCompactProps
|
||||||
> = ({
|
> = ({
|
||||||
galleryHeaderImageUrl,
|
galleryHeaderImageUrl,
|
||||||
|
galleryHeaderText,
|
||||||
galleryTitle,
|
galleryTitle,
|
||||||
galleryInfoSpans,
|
galleryInfoSpans,
|
||||||
galleryColumns,
|
galleryColumns,
|
||||||
@ -87,6 +90,15 @@ const GallerySettingsSectionCompact: React.FC<
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<input
|
||||||
|
className='w-full rounded border border-gray-300 px-2 py-1 text-xs'
|
||||||
|
placeholder='Header text (if no image)'
|
||||||
|
value={galleryHeaderText}
|
||||||
|
onChange={(event) =>
|
||||||
|
onUpdateHeader({ galleryHeaderText: event.target.value })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
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'
|
||||||
placeholder='Title (location note)'
|
placeholder='Title (location note)'
|
||||||
|
|||||||
@ -172,6 +172,7 @@ export interface GallerySettingsSectionProps {
|
|||||||
export interface GallerySettingsSectionCompactProps {
|
export interface GallerySettingsSectionCompactProps {
|
||||||
// Header settings
|
// Header settings
|
||||||
galleryHeaderImageUrl: string;
|
galleryHeaderImageUrl: string;
|
||||||
|
galleryHeaderText: string;
|
||||||
galleryTitle: string;
|
galleryTitle: string;
|
||||||
galleryInfoSpans: GalleryInfoSpan[];
|
galleryInfoSpans: GalleryInfoSpan[];
|
||||||
galleryColumns: number;
|
galleryColumns: number;
|
||||||
@ -184,6 +185,7 @@ export interface GallerySettingsSectionCompactProps {
|
|||||||
// Header handlers
|
// Header handlers
|
||||||
onUpdateHeader: (patch: {
|
onUpdateHeader: (patch: {
|
||||||
galleryHeaderImageUrl?: string;
|
galleryHeaderImageUrl?: string;
|
||||||
|
galleryHeaderText?: string;
|
||||||
galleryTitle?: string;
|
galleryTitle?: string;
|
||||||
galleryColumns?: number;
|
galleryColumns?: number;
|
||||||
galleryTitleFontFamily?: string;
|
galleryTitleFontFamily?: string;
|
||||||
|
|||||||
@ -34,6 +34,7 @@ const GalleryElement: React.FC<GalleryElementProps> = ({
|
|||||||
const cards: GalleryCard[] = element.galleryCards || [];
|
const cards: GalleryCard[] = element.galleryCards || [];
|
||||||
const infoSpans: GalleryInfoSpan[] = element.galleryInfoSpans || [];
|
const infoSpans: GalleryInfoSpan[] = element.galleryInfoSpans || [];
|
||||||
const headerImageUrl = element.galleryHeaderImageUrl;
|
const headerImageUrl = element.galleryHeaderImageUrl;
|
||||||
|
const headerText = element.galleryHeaderText;
|
||||||
const title = element.galleryTitle;
|
const title = element.galleryTitle;
|
||||||
const columns = element.galleryColumns || 3;
|
const columns = element.galleryColumns || 3;
|
||||||
|
|
||||||
@ -61,8 +62,8 @@ const GalleryElement: React.FC<GalleryElementProps> = ({
|
|||||||
className='flex flex-col gap-2 p-3 rounded-xl min-w-[200px] backdrop-blur-sm'
|
className='flex flex-col gap-2 p-3 rounded-xl min-w-[200px] backdrop-blur-sm'
|
||||||
style={{ backgroundColor: backgroundColor || 'rgba(0, 0, 0, 0.6)' }}
|
style={{ backgroundColor: backgroundColor || 'rgba(0, 0, 0, 0.6)' }}
|
||||||
>
|
>
|
||||||
{/* Header image */}
|
{/* Header: image takes priority, otherwise render text */}
|
||||||
{headerImageUrl && (
|
{headerImageUrl ? (
|
||||||
// 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)}
|
||||||
@ -70,7 +71,14 @@ const GalleryElement: React.FC<GalleryElementProps> = ({
|
|||||||
className='w-full h-auto object-cover rounded-lg'
|
className='w-full h-auto object-cover rounded-lg'
|
||||||
draggable={false}
|
draggable={false}
|
||||||
/>
|
/>
|
||||||
)}
|
) : headerText ? (
|
||||||
|
<div
|
||||||
|
className='text-2xl font-bold px-1 py-2'
|
||||||
|
style={titleFontStyle}
|
||||||
|
>
|
||||||
|
{headerText}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
{title && (
|
{title && (
|
||||||
|
|||||||
@ -94,6 +94,7 @@ export interface CanvasElement extends BaseCanvasElement {
|
|||||||
galleryCards?: GalleryCard[];
|
galleryCards?: GalleryCard[];
|
||||||
// Gallery header settings
|
// Gallery header settings
|
||||||
galleryHeaderImageUrl?: string;
|
galleryHeaderImageUrl?: string;
|
||||||
|
galleryHeaderText?: string;
|
||||||
galleryTitle?: string;
|
galleryTitle?: string;
|
||||||
galleryInfoSpans?: GalleryInfoSpan[];
|
galleryInfoSpans?: GalleryInfoSpan[];
|
||||||
galleryColumns?: number;
|
galleryColumns?: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user