fix: align marketplace home filters to left

This commit is contained in:
CodingOnStar 2026-07-24 17:34:46 +08:00
parent 3ed6d9f9af
commit 433a553f88
4 changed files with 10 additions and 9 deletions

View File

@ -51,7 +51,9 @@ describe('PluginTypeSwitch', () => {
it('exposes the selected category and updates the URL in the home variant', async () => {
const user = userEvent.setup()
const { onUrlUpdate } = renderSwitch('?category=all', { variant: 'home' })
const categoryGroup = screen.getByRole('group', { name: 'marketplace.allPlugins' })
expect(categoryGroup).toHaveClass('w-full', 'justify-start', 'gap-1')
expect(screen.getByRole('button', { name: 'category.all' })).toHaveAttribute(
'aria-pressed',
'true',

View File

@ -27,6 +27,11 @@ describe('HomeCatalogNavigation', () => {
it('keeps template navigation inside the Marketplace platform', () => {
render(<HomeCatalogNavigation isMarketplacePlatform />)
const navigationSection = screen.getByRole('region', { name: 'common.mainNav.marketplace' })
expect(navigationSection).toHaveClass('px-9')
expect(navigationSection.firstElementChild).toHaveClass('w-full')
expect(navigationSection.firstElementChild).not.toHaveClass('mx-auto', 'max-w-[1200px]')
expect(screen.getByText('plugin.marketplace.home.plugins')).toHaveAttribute(
'aria-current',
'page',

View File

@ -1,6 +1,5 @@
'use client'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from '#i18n'
import Link from '@/next/link'
import { getMarketplaceUrl } from '@/utils/var'
@ -17,14 +16,9 @@ function HomeCatalogNavigation({ isMarketplacePlatform }: HomeCatalogNavigationP
return (
<section
aria-label={t(($) => $['mainNav.marketplace'], { ns: 'common' })}
className="w-full shrink-0 bg-background-default px-8 pt-6 pb-4"
className="w-full shrink-0 bg-background-default px-9 pt-6 pb-4"
>
<div
className={cn(
'mx-auto w-full',
isMarketplacePlatform ? 'max-w-[1200px]' : 'max-w-[1188px]',
)}
>
<div className="w-full">
<nav
aria-label={t(($) => $['mainNav.marketplace'], { ns: 'common' })}
className="-ml-2 flex h-8 items-center gap-1"

View File

@ -78,7 +78,7 @@ function PluginTypeSwitch({ className, variant = 'default' }: PluginTypeSwitchPr
isHero
? 'flex shrink-0 items-center gap-1 overflow-x-auto'
: isHome
? 'flex shrink-0 items-center gap-1 overflow-x-auto'
? 'flex w-full shrink-0 items-center justify-start gap-1 overflow-x-auto'
: 'flex shrink-0 items-center justify-center space-x-2 bg-background-body py-3',
className,
)}