From 7d14ca2de0d01bdc6702f8081ae66cda1fa88164 Mon Sep 17 00:00:00 2001 From: Balint Gabor <127662+gbalint@users.noreply.github.com> Date: Fri, 3 May 2024 14:40:45 +0200 Subject: [PATCH] Added default content for preferredcontents --- utopia/components.utopia.js | 120 ++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/utopia/components.utopia.js b/utopia/components.utopia.js index df02f4a..8ddf3f5 100644 --- a/utopia/components.utopia.js +++ b/utopia/components.utopia.js @@ -39,16 +39,18 @@ const PlaceholderContent = { variants: [], } -const RowVariants = [ - { - label: 'Row with Placeholders', - imports: - 'import { Row, Placeholder } from "/app/components/Components"', - code: ` - - +const RowWithPlaceholdersVariant = { + label: 'Row with Placeholders', + imports: + 'import { Row, Placeholder } from "/app/components/Components"', + code: ` + + `, - }, +} + +const RowVariants = [ + RowWithPlaceholdersVariant, { label: 'Row - empty', imports: @@ -93,16 +95,18 @@ const SectionVariants = [ }, ] -const ColumnVariants = [ - { - label: 'Column with Placeholders', - imports: - "import { Column, Placeholder } from '/app/components/Components'", - code: ` - - +const ColumnWithPlaceholdersVariant = { + label: 'Column with Placeholders', + imports: + "import { Column, Placeholder } from '/app/components/Components'", + code: ` + + `, - }, +} + +const ColumnVariants = [ + ColumnWithPlaceholdersVariant, { label: 'Column - empty', imports: @@ -111,6 +115,20 @@ const ColumnVariants = [ }, ] +const DefaultContent = [ + //title text column row image + { + component: 'Row', + moduleName: '/app/components/Components', + variants: RowWithPlaceholdersVariant, + }, + { + component: 'Column', + moduleName: '/app/components/Components', + variants: ColumnWithPlaceholdersVariant, + }, +] + const Components = { '/app/routes/_index': { TestimonialCard: { @@ -269,11 +287,17 @@ const Components = { properties: { left: { control: 'jsx', - preferredContents: PlaceholderContent, + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, right: { control: 'jsx', - preferredContents: PlaceholderContent, + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, }, focus: 'never', @@ -292,11 +316,17 @@ const Components = { properties: { left: { control: 'jsx', - preferredContents: [PlaceholderContent], + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, right: { control: 'jsx', - preferredContents: [PlaceholderContent], + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, inverted: Utopia.checkboxControl(), }, @@ -319,11 +349,17 @@ const Components = { properties: { left: { control: 'jsx', - preferredContents: PlaceholderContent, + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, right: { control: 'jsx', - preferredContents: PlaceholderContent, + preferredContents: [ + PlaceholderContent, + ...DefaultContent, + ], }, padded: Utopia.checkboxControl(), gap: Utopia.numberControl(), @@ -400,31 +436,15 @@ const Components = { left: { control: 'jsx', preferredContents: [ - { - component: 'Row', - moduleName: '/app/components/Components', - variants: RowVariants, - }, - { - component: 'Column', - moduleName: '/app/components/Components', - variants: ColumnVariants, - }, + PlaceholderContent, + ...DefaultContent, ], }, right: { control: 'jsx', preferredContents: [ - { - component: 'Row', - moduleName: '/app/components/Components', - variants: RowVariants, - }, - { - component: 'Column', - moduleName: '/app/components/Components', - variants: ColumnVariants, - }, + PlaceholderContent, + ...DefaultContent, ], }, }, @@ -439,16 +459,8 @@ const Components = { focus: 'never', children: { preferredContents: [ - { - component: 'Row', - moduleName: '/app/components/Components', - variants: RowVariants, - }, - { - component: 'Column', - moduleName: '/app/components/Components', - variants: ColumnVariants, - }, + PlaceholderContent, + ...DefaultContent, ], }, variants: SectionVariants,