-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Product support and better rendering of columns
- Loading branch information
Showing
25 changed files
with
184 additions
and
513 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
15 changes: 13 additions & 2 deletions
15
packages/magento-pagebuilder/ContentTypes/ColumnGroup/ColumnGroup.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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import { Box } from '@mui/material' | ||
import { ColumnGroupContentType } from './types' | ||
import { extractAdvancedProps } from '../../utils' | ||
|
||
/** | ||
* Page Builder ColumnGroup component. | ||
* | ||
* This component is part of the Page Builder / PWA integration. It can be consumed without Page Builder. | ||
*/ | ||
export const ColumnGroup: ColumnGroupContentType['component'] = (props) => { | ||
const { display, children } = props | ||
const [cssProps, cssClasses, additional] = extractAdvancedProps(props) | ||
const { children, appearance, contentType } = additional | ||
|
||
return <Box sx={{ display: 'flex', flexWrap: { xs: 'wrap', md: 'initial' } }}>{children}</Box> | ||
return ( | ||
<Box | ||
data-appearance={appearance} | ||
data-content-type={contentType} | ||
className={cssClasses.join(' ')} | ||
sx={cssProps} | ||
> | ||
{children} | ||
</Box> | ||
) | ||
} |
5 changes: 3 additions & 2 deletions
5
packages/magento-pagebuilder/ContentTypes/ColumnGroup/columnGroupAggregator.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { getIsHidden } from '../../utils' | ||
import { ColumnGroupContentType } from './types' | ||
import { getAdvanced } from '../../utils' | ||
import type { ColumnGroupContentType } from './types' | ||
|
||
export const columnGroupAggregator: ColumnGroupContentType['configAggregator'] = (node) => ({ | ||
display: node.style.display, | ||
...getAdvanced(node), | ||
}) |
5 changes: 3 additions & 2 deletions
5
packages/magento-pagebuilder/ContentTypes/ColumnGroup/types.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { ContentType, ContentTypeConfig } from '../../types' | ||
import { AdvancedProps } from '../../utils' | ||
|
||
type ColumnGroupConfig = ContentTypeConfig<'column-group'> | ||
|
||
export type ButtonItemProps = Pick<React.CSSProperties, 'display'> | ||
export type ColumnGroupProps = AdvancedProps & Pick<React.CSSProperties, 'display'> | ||
|
||
export type ColumnGroupContentType = ContentType<ColumnGroupConfig, ButtonItemProps> | ||
export type ColumnGroupContentType = ContentType<ColumnGroupConfig, ColumnGroupProps> |
24 changes: 24 additions & 0 deletions
24
packages/magento-pagebuilder/ContentTypes/ColumnLine/ColumnLine.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,24 @@ | ||
import { Box } from '@mui/material' | ||
import { extractAdvancedProps } from '../../utils' | ||
import { ColumnLineContentType } from './types' | ||
|
||
/** | ||
* Page Builder ColumnGroup component. | ||
* | ||
* This component is part of the Page Builder / PWA integration. It can be consumed without Page Builder. | ||
*/ | ||
export const ColumnLine: ColumnLineContentType['component'] = (props) => { | ||
const [cssProps, cssClasses, additional] = extractAdvancedProps(props) | ||
const { children, appearance, contentType, display, width, sx } = additional | ||
|
||
return ( | ||
<Box | ||
data-appearance={appearance} | ||
data-content-type={contentType} | ||
className={cssClasses.join(' ')} | ||
sx={[...(Array.isArray(sx) ? sx : [sx]), cssProps, { display, width }]} | ||
> | ||
{children} | ||
</Box> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/magento-pagebuilder/ContentTypes/ColumnLine/columnLineAggregator.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { getAdvanced } from '../../utils' | ||
import type { ColumnLineContentType } from './types' | ||
|
||
export const columnLineAggregator: ColumnLineContentType['configAggregator'] = (node) => ({ | ||
display: node.style.display, | ||
width: node.style.width, | ||
...getAdvanced(node), | ||
}) |
8 changes: 8 additions & 0 deletions
8
packages/magento-pagebuilder/ContentTypes/ColumnLine/types.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ContentType, ContentTypeConfig } from '../../types' | ||
import { AdvancedProps } from '../../utils' | ||
|
||
type ColumnLineConfig = ContentTypeConfig<'column-group'> | ||
|
||
export type ColumnLineProps = AdvancedProps & Pick<React.CSSProperties, 'display' | 'width'> | ||
|
||
export type ColumnLineContentType = ContentType<ColumnLineConfig, ColumnLineProps> |
16 changes: 0 additions & 16 deletions
16
packages/magento-pagebuilder/ContentTypes/Products/Carousel/carousel.gql.ce.js
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
packages/magento-pagebuilder/ContentTypes/Products/Carousel/carousel.gql.ee.js
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
packages/magento-pagebuilder/ContentTypes/Products/Carousel/carousel.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/magento-pagebuilder/ContentTypes/Products/Carousel/index.js
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
packages/magento-pagebuilder/ContentTypes/Products/Carousel/useCarousel.js
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/magento-pagebuilder/ContentTypes/Products/Products.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,26 @@ | ||
import { ProductScroller } from '@graphcommerce/magento-product' | ||
import { Container } from '@mui/material' | ||
import { | ||
ProductListItems, | ||
productListRenderer, | ||
} from '../../../../examples/magento-graphcms/components' | ||
import { extractAdvancedProps } from '../../utils' | ||
import { ProductsContentType, ProductsProps } from './types' | ||
|
||
export const Products: ProductsContentType['component'] = (props) => { | ||
const [cssProps, cssClasses, additional] = extractAdvancedProps(props) | ||
const { appearance, products } = additional | ||
|
||
if (appearance === 'grid') { | ||
return ( | ||
<Container> | ||
<ProductListItems items={products} size='small' titleComponent='h3' title={''} /> | ||
</Container> | ||
) | ||
} | ||
return ( | ||
<Container> | ||
<ProductScroller items={products} productListRenderer={productListRenderer} /> | ||
</Container> | ||
) | ||
} |
26 changes: 0 additions & 26 deletions
26
packages/magento-pagebuilder/ContentTypes/Products/configAggregator.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.