Skip to content

Commit

Permalink
🐛 fix: 修正索引问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 9, 2021
1 parent f688dcd commit 5b0e29c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/journey-map/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import type { FC, CSSProperties, ReactNode } from 'react';
import type { FC, CSSProperties } from 'react';
import cls from 'classnames';

import Stage from './Stages';
Expand Down Expand Up @@ -47,13 +47,13 @@ const JourneyMap: FC<JourneyMapProps> = ({
}) => {
const store = useJourneyMap({ data, onChange, title, config });

const sections: Record<SectionType, ReactNode> = {
action: <Actions />,
stage: <Stage />,
emotion: <Chart />,
thought: <Thoughts />,
chance: <div />,
painSpot: <div />,
const sections: Record<SectionType, FC> = {
action: Actions,
stage: Stage,
emotion: Chart,
thought: Thoughts,
chance: () => <div />,
painSpot: () => <div />,
};

const arrange = store.config?.arrange || [
Expand All @@ -73,7 +73,10 @@ const JourneyMap: FC<JourneyMapProps> = ({
<div className="avx-journey-map-title">{store.title}</div>
) : null}
<div className="avx-journey-map-content">
{arrange.map((a) => sections[a])}
{arrange.map((a) => {
const Section = sections[a];
return <Section key={a} />;
})}
</div>
</div>
</JourneyMapStore.Provider>
Expand Down

0 comments on commit 5b0e29c

Please sign in to comment.