Skip to content

Commit

Permalink
fix: sort child area list by LR index
Browse files Browse the repository at this point in the history
  • Loading branch information
viet nguyen committed Jan 3, 2024
1 parent 8f6b03e commit 3d43273
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/editArea/[slug]/general/components/AreaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { AreaType } from '@/js/types'
import { AreaItem } from './AreaItem'
import { GluttenFreeCrumbs } from '@/components/ui/BreadCrumbs'
import { areaLeftRightIndexComparator } from '@/js/utils'

type AreaListProps = Pick<AreaType, 'uuid' | 'areaName' | 'pathTokens' | 'ancestors'> & {
areas: AreaType[]
Expand Down Expand Up @@ -33,6 +34,6 @@ export const AreaListForm: React.FC<AreaListProps> = ({ areaName, uuid, pathToke

export const AreaList: React.FC<{ parentUuid: string, areas: AreaType[], editMode?: boolean }> = ({ areas, parentUuid, editMode = false }) => (
<div className='two-column-table'>
{areas.map((item, index) =>
{[...areas].sort(areaLeftRightIndexComparator).map((item, index) =>
<AreaItem key={item.uuid} area={item} index={index + 1} parentUuid={parentUuid} editMode={editMode} />)}
</div>)

0 comments on commit 3d43273

Please sign in to comment.