-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from DnD-Montreal/229-create-resizable-steppe…
…r-atom-component Add re-usable stepper form component
- Loading branch information
Showing
5 changed files
with
252 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {Box, Step, StepLabel, Stepper} from '@mui/material' | ||
import React, {ReactNode} from 'react' | ||
import styled from 'styled-components' | ||
|
||
type StepperFormPropType = { | ||
stepTitles: string[] | ||
stepContent: ReactNode[] | ||
stepFooter: ReactNode[] | ||
activeStep: number | ||
isDrawer: boolean | ||
} | ||
|
||
const StyledBox = styled(Box)` | ||
padding: 32px 0px 16px 0px; | ||
width: 100%; | ||
` | ||
|
||
const FormBox = styled(Box)` | ||
@media only screen and (max-width: 768px) { | ||
width: 100vw; | ||
} | ||
margin-top: 16px; | ||
width: ${(props) => (props.className === 'DrawerForm' ? '100%' : '65vw')}; | ||
` | ||
|
||
const StepperForm = ({ | ||
activeStep, | ||
stepTitles, | ||
stepContent, | ||
stepFooter, | ||
isDrawer, | ||
}: StepperFormPropType) => ( | ||
<FormBox className={isDrawer ? 'DrawerForm' : 'FormBox'}> | ||
<Stepper activeStep={activeStep}> | ||
{stepTitles.map((label: string) => ( | ||
<Step completed={activeStep > 0}> | ||
<StepLabel>{label}</StepLabel> | ||
</Step> | ||
))} | ||
</Stepper> | ||
<StyledBox>{stepContent[activeStep]}</StyledBox> | ||
{stepFooter[activeStep]} | ||
</FormBox> | ||
) | ||
|
||
StepperForm.displayName = 'StepperForm' | ||
export default StepperForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export {default as DataTable} from './DataTable' | ||
export {default as Drawer} from './Drawer' | ||
export {default as Link} from './Link' | ||
export {default as StepperForm} from './StepperForm' |
Oops, something went wrong.