Skip to content

Commit

Permalink
Move the category fragment to the category prop
Browse files Browse the repository at this point in the history
  • Loading branch information
paales committed Jan 16, 2025
1 parent 87df248 commit 590f064
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-tigers-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-category': patch
---

Move the category fragment to the category prop
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ProductListLayoutClassic = memoDeep((props: ProductListLayoutProps)
</LayoutTitle>
<CategoryDescription
sx={(theme) => ({ textAlign: 'center', mb: theme.spacings.sm })}
{...category}
category={category}
/>
<CategoryChildren
params={params}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const ProductListLayoutDefault = memoDeep((props: ProductListLayoutProps)
textAlignMd='center'
textAlignSm='center'
sx={(theme) => ({ px: theme.page.horizontal })}
{...category}
category={category}
/>
<CategoryChildren
sx={(theme) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const ProductListLayoutSidebar = memoDeep((props: ProductListLayoutProps)
<>
<Typography variant='h1'>{title}</Typography>

<CategoryDescription textAlignMd='start' textAlignSm='start' {...category} />
<CategoryDescription textAlignMd='start' textAlignSm='start' category={category} />
<MediaQuery query={(theme) => theme.breakpoints.down('md')}>
<CategoryChildren params={params}>{category?.children}</CategoryChildren>
</MediaQuery>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ProductListLayoutClassic = memoDeep((props: ProductListLayoutProps)
</LayoutTitle>
<CategoryDescription
sx={(theme) => ({ textAlign: 'center', mb: theme.spacings.sm })}
{...category}
category={category}
/>
<CategoryChildren
params={params}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const ProductListLayoutDefault = memoDeep((props: ProductListLayoutProps)
textAlignMd='center'
textAlignSm='center'
sx={(theme) => ({ px: theme.page.horizontal })}
{...category}
category={category}
/>
<CategoryChildren
sx={(theme) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const ProductListLayoutSidebar = memoDeep((props: ProductListLayoutProps)
<>
<Typography variant='h1'>{title}</Typography>

<CategoryDescription textAlignMd='start' textAlignSm='start' {...category} />
<CategoryDescription textAlignMd='start' textAlignSm='start' category={category} />
<MediaQuery query={(theme) => theme.breakpoints.down('md')}>
<CategoryChildren params={params}>{category?.children}</CategoryChildren>
</MediaQuery>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ const { withState } = extendableComponent<StateProps, typeof componentName, type
parts,
)

export type CategoryDescriptionProps = Omit<CategoryDescriptionFragment, 'uid'> &
StateProps & { sx?: SxProps<Theme> }
export type CategoryDescriptionProps = StateProps & {
sx?: SxProps<Theme>
category: Omit<CategoryDescriptionFragment, 'uid'>
}

export function CategoryDescription(props: CategoryDescriptionProps) {
const {
name,
description,
display_mode,
sx = [],
textAlignSm = 'center',
textAlignMd = 'center',
...divProps
} = props
const { category, sx = [], textAlignSm = 'center', textAlignMd = 'center', ...divProps } = props
const { description } = category

const classes = withState({ textAlignSm, textAlignMd })

Expand Down

0 comments on commit 590f064

Please sign in to comment.