-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into fetch-hooks
- Loading branch information
Showing
102 changed files
with
7,810 additions
and
7,737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
packages/components/src/components/ContentfulContainer/ContentfulContainer.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 2 additions & 16 deletions
18
packages/components/src/components/ContentfulContainer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/components/src/components/DesignComponent/DesignComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
CompositionComponentNode, | ||
ResolveDesignValueType, | ||
StyleProps, | ||
} from '@contentful/experience-builder-core/types'; | ||
import React from 'react'; | ||
|
||
export type DesignComponentProps<EditorMode = boolean> = EditorMode extends true | ||
? { | ||
children?: React.ReactNode; | ||
className?: string; | ||
cfHyperlink?: StyleProps['cfHyperlink']; | ||
cfOpenInNewTab?: StyleProps['cfOpenInNewTab']; | ||
editorMode?: EditorMode; | ||
node: CompositionComponentNode; | ||
resolveDesignValue?: ResolveDesignValueType; | ||
renderDropZone: ( | ||
node: CompositionComponentNode, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
props?: Record<string, any> | ||
) => React.ReactNode; | ||
} | ||
: // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
Record<string, any>; | ||
|
||
const designComponentStyle = { display: 'contents' }; | ||
|
||
// Feel free to do any magic as regards variable definitions for design components | ||
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell | ||
export const DesignComponent: React.FC<DesignComponentProps> = (props) => { | ||
if (props.editorMode) { | ||
const { node } = props; | ||
|
||
return props.renderDropZone(node, { | ||
['data-test-id']: 'contentful-container', | ||
['data-cf-node-id']: node.data.id, | ||
['data-cf-node-block-id']: node.data.blockId, | ||
['data-cf-node-block-type']: node.type, | ||
id: 'design-component', | ||
className: props.className, | ||
style: designComponentStyle, | ||
}); | ||
} | ||
// Using a display contents so design component content/children | ||
// can appear as if they are direct children of the div wrapper's parent | ||
return <div data-test-id="design-component" {...props} style={designComponentStyle} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './DesignComponent'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
.cf-text { | ||
color: var(--cf-text-color); | ||
font-size: var(--cf-text-base); | ||
font-weight: var(--cf-font-normal); | ||
font-family: var(--cf-font-family-sans); | ||
margin: var(--cf-spacing-0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ComponentDefinition } from '@/types'; | ||
|
||
import { CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_CONTAINER_ID } from '@/constants'; | ||
import { containerBuiltInStyles } from './styles'; | ||
|
||
export const containerDefinition: ComponentDefinition = { | ||
id: CONTENTFUL_CONTAINER_ID, | ||
name: 'Container', | ||
category: CONTENTFUL_COMPONENT_CATEGORY, | ||
children: true, | ||
variables: containerBuiltInStyles, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './components'; | ||
export * from './styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.