Skip to content

Commit

Permalink
Added default content for preferredcontents
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalint committed May 3, 2024
1 parent 1fe9fa6 commit 7d14ca2
Showing 1 changed file with 66 additions and 54 deletions.
120 changes: 66 additions & 54 deletions utopia/components.utopia.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ const PlaceholderContent = {
variants: [],
}

const RowVariants = [
{
label: 'Row with Placeholders',
imports:
'import { Row, Placeholder } from "/app/components/Components"',
code: `<Row style={{ gap: 10 }} padded >
<Placeholder />
<Placeholder />
const RowWithPlaceholdersVariant = {
label: 'Row with Placeholders',
imports:
'import { Row, Placeholder } from "/app/components/Components"',
code: `<Row style={{ gap: 10 }} padded >
<Placeholder />
<Placeholder />
</Row>`,
},
}

const RowVariants = [
RowWithPlaceholdersVariant,
{
label: 'Row - empty',
imports:
Expand Down Expand Up @@ -93,16 +95,18 @@ const SectionVariants = [
},
]

const ColumnVariants = [
{
label: 'Column with Placeholders',
imports:
"import { Column, Placeholder } from '/app/components/Components'",
code: `<Column style={{ gap: 10 }} padded >
<Placeholder />
<Placeholder />
const ColumnWithPlaceholdersVariant = {
label: 'Column with Placeholders',
imports:
"import { Column, Placeholder } from '/app/components/Components'",
code: `<Column style={{ gap: 10 }} padded >
<Placeholder />
<Placeholder />
</Column>`,
},
}

const ColumnVariants = [
ColumnWithPlaceholdersVariant,
{
label: 'Column - empty',
imports:
Expand All @@ -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: {
Expand Down Expand Up @@ -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',
Expand All @@ -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(),
},
Expand All @@ -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(),
Expand Down Expand Up @@ -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,
],
},
},
Expand All @@ -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,
Expand Down

0 comments on commit 7d14ca2

Please sign in to comment.