Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -7,30 +7,30 @@ export type StepsOptions = {
|
||||
initialStep: number;
|
||||
};
|
||||
|
||||
export function useStepBar({ initialStep }: StepsOptions) {
|
||||
export const useStepBar = ({ initialStep }: StepsOptions) => {
|
||||
const [stepBarInternal, setStepBarInternal] =
|
||||
useRecoilState(stepBarInternalState);
|
||||
|
||||
function nextStep() {
|
||||
const nextStep = () => {
|
||||
setStepBarInternal((prevState) => ({
|
||||
...prevState,
|
||||
activeStep: prevState.activeStep + 1,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
function prevStep() {
|
||||
const prevStep = () => {
|
||||
setStepBarInternal((prevState) => ({
|
||||
...prevState,
|
||||
activeStep: prevState.activeStep - 1,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
function reset() {
|
||||
const reset = () => {
|
||||
setStepBarInternal((prevState) => ({
|
||||
...prevState,
|
||||
activeStep: 0,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const setStep = useCallback(
|
||||
(step: number) => {
|
||||
@ -57,4 +57,4 @@ export function useStepBar({ initialStep }: StepsOptions) {
|
||||
setStep,
|
||||
activeStep: stepBarInternal.activeStep,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user