Skip to content

Commit

Permalink
fix(FOROME-1636): fix flow of wizard (#949)
Browse files Browse the repository at this point in the history
* fix(FOROME-1636): fix flow of wizard

* fix(FOROME-1636): extract function
  • Loading branch information
QSdmitrioul authored Sep 16, 2022
1 parent 9bd1c86 commit adc957c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styles from './build-flow.module.css'
import { ReactElement } from 'react'
import { observer } from 'mobx-react-lite'

import { IWizardScenario } from '@pages/main/components/selected-dataset/build-flow/components/wizard/wizard.interface'
import { BuildFlowHeader } from './components/build-flow-header'
import wizardStore from './components/wizard/wizard.store'

Expand All @@ -13,19 +14,35 @@ export const SelectedDatasetBuildFlow = observer(
wizardStore.resetWizard()
}

const renderCard = ({ component, ...rest }: IWizardScenario) => {
const Component = () =>
component({
...rest,
})
return !rest.hidden && <Component key={rest.id} />
}

return (
<div className={styles.buildFlow}>
<div className={styles.buildFlow__container}>
<BuildFlowHeader goBack={handleGoBack} />

<div>
{wizardStore.wizardScenario.map(({ component, ...rest }) => {
const Component = () =>
component({
...rest,
})
return !rest.hidden && <Component key={rest.id} />
})}
{wizardStore.wizardScenario
.filter(it => it.position !== 'left' && it.position !== 'right')
.map(renderCard)}
<div className="flex">
<div className="w-[calc(50%-8px)]">
{wizardStore.wizardScenario
.filter(it => it.position === 'left')
.map(renderCard)}
</div>
<div className="ml-4 w-[calc(50%-8px)]">
{wizardStore.wizardScenario
.filter(it => it.position === 'right')
.map(renderCard)}
</div>
</div>
</div>
</div>
</div>
Expand Down
17 changes: 3 additions & 14 deletions src/ui/card/card.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
border-radius: theme("spacing.2");
box-shadow: theme("boxShadow.card");
padding: theme("spacing.4");
width: calc(50% - 8px);
width: 100%;
margin-top: 16px;

&_title {
font-weight: 700 !important;
Expand Down Expand Up @@ -32,19 +33,7 @@
transform: translateY(40px);
}

&_position-right {
margin-top: 16px;
float: right;
clear: right;
}

&_position-left {
margin-top: 16px;
float: left;
clear: left;
}

&_position-stretch {
width: 100%;
margin-top: 0;
}
}

0 comments on commit adc957c

Please sign in to comment.