Skip to content

Commit

Permalink
Use prop instead of loading config for next button
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens committed Nov 25, 2024
1 parent 59e780a commit e3016b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/components/NextButton/NextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@ import styled from 'styled-components'

import Button from 'components/Button'

import configuration from '../../shared/services/configuration/configuration'

const appMode = configuration.featureFlags.appMode

const StyledButton = styled(Button)`
margin-right: ${appMode ? '0' : '15px !important'};
width: ${appMode ? '100%' : 'auto'};
`

interface Props {
className?: string
appMode?: boolean
children: ReactNode
onClick: (event: BaseSyntheticEvent) => void
}

const NextButton = ({ className = '', children, onClick }: Props) => (
const StyledButton = styled(Button)<Props>`
${({ appMode }) => !appMode && 'margin-right: 15px !important'};
${({ appMode }) => appMode && 'width: 100%;'}
`

const NextButton = ({ appMode, children, onClick, ...restProps }: Props) => (
<StyledButton
className={className}
data-testid="next-button"
{...restProps}
onClick={onClick}
taskflow={!appMode}
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const WizardStep = ({ wizardStep, meta, next, previous }: WizardStepProps) => {
(!mapActive &&
(appMode ? (
<NextButton
appMode
onClick={(e) => {
handleSubmit(e, next, wizardStep.formAction)
}}
Expand Down

0 comments on commit e3016b0

Please sign in to comment.