Skip to content

Commit

Permalink
feat: fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Falkaniere committed Jul 20, 2023
1 parent f2c5f41 commit 51353b0
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 72 deletions.
26 changes: 14 additions & 12 deletions packages/yoga/src/Stepper/native/Dots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,20 @@ const Label = styled(Text.Bold)(
`,
);

const Dots = ({ activeStep, labels, color }) => (
<Wrapper>
{labels.map((label, index) => (
<DotWrapper key={label}>
<Dot active={activeDot(index, activeStep)} color={color} />
<Label active={activeDot(index, activeStep)} color={color}>
{label}
</Label>
</DotWrapper>
))}
</Wrapper>
);
const Dots = ({ activeStep, labels, color }) => {
return (
<Wrapper>
{labels.map((label, index) => (
<DotWrapper key={label}>
<Dot active={activeDot(index, activeStep)} color={color} />
<Label active={activeDot(index, activeStep)} color={color}>
{label}
</Label>
</DotWrapper>
))}
</Wrapper>
);
};

Dots.propTypes = {
activeStep: number,
Expand Down
20 changes: 11 additions & 9 deletions packages/yoga/src/Stepper/native/Line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ const ActiveLine = styled.View(
`,
);

const Line = ({ activeStep, totalSteps, color }) => (
<Wrapper>
<InactiveLine />
<ActiveLine
width={activeStep <= 0 ? 0 : (activeStep / totalSteps) * 100}
color={color}
/>
</Wrapper>
);
const Line = ({ activeStep, totalSteps, color }) => {
return (
<Wrapper>
<InactiveLine />
<ActiveLine
width={activeStep <= 0 ? 0 : (activeStep / totalSteps) * 100}
color={color}
/>
</Wrapper>
);
};

Line.propTypes = {
activeStep: number,
Expand Down
36 changes: 19 additions & 17 deletions packages/yoga/src/Stepper/native/Stepper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,25 @@ const LineWrapper = styled.View(

/** Stepper is responsible for the logic that drives a stepped workflow, it
provides a wizard-like workflow by dividing content into logical steps. */
const Stepper = ({ children, activeStep, color, ...rest }) => (
<Wrapper {...rest}>
<LineWrapper>
<Line
activeStep={activeStep}
totalSteps={React.Children.count(children) - 1}
color={color}
/>
<Dots
activeStep={activeStep}
labels={React.Children.map(children, child => child.props.label)}
color={color}
/>
</LineWrapper>
{React.Children.toArray(children)[activeStep]}
</Wrapper>
);
const Stepper = ({ children, activeStep, color, ...rest }) => {
return (
<Wrapper {...rest}>
<LineWrapper>
<Line
activeStep={activeStep}
totalSteps={React.Children.count(children) - 1}
color={color}
/>
<Dots
activeStep={activeStep}
labels={React.Children.map(children, child => child.props.label)}
color={color}
/>
</LineWrapper>
{React.Children.toArray(children)[activeStep]}
</Wrapper>
);
};

Stepper.displayName = 'Stepper';

Expand Down
30 changes: 16 additions & 14 deletions packages/yoga/src/Stepper/web/Dots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,22 @@ const Wrapper = styled.div`
justify-content: space-between;
`;

const Dots = ({ activeStep, labels, color }) => (
<Wrapper>
{labels.map((label, index) => (
<DotWrapper
active={activeDot(index, activeStep)}
color={color}
key={label}
>
<Dot />
<Label as="span">{label}</Label>
</DotWrapper>
))}
</Wrapper>
);
const Dots = ({ activeStep, labels, color }) => {
return (
<Wrapper>
{labels.map((label, index) => (
<DotWrapper
active={activeDot(index, activeStep)}
color={color}
key={label}
>
<Dot />
<Label as="span">{label}</Label>
</DotWrapper>
))}
</Wrapper>
);
};

Dots.propTypes = {
activeStep: number,
Expand Down
42 changes: 22 additions & 20 deletions packages/yoga/src/Stepper/web/Stepper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,28 @@ const LineWrapper = styled.div`

/** Stepper is responsible for the logic that drives a stepped workflow, it
provides a wizard-like workflow by dividing content into logical steps. */
const Stepper = ({ children, activeStep, color, ...rest }) => (
<Root {...rest}>
<LineWrapper>
<Line
width={
activeStep <= 0
? 0
: (activeStep / (React.Children.count(children) - 1)) * 100
}
color={color}
/>
<Dots
activeStep={activeStep}
labels={React.Children.map(children, child => child.props.label)}
color={color}
/>
</LineWrapper>
{React.Children.toArray(children)[activeStep]}
</Root>
);
const Stepper = ({ children, activeStep, color, ...rest }) => {
return (
<Root {...rest}>
<LineWrapper>
<Line
width={
activeStep <= 0
? 0
: (activeStep / (React.Children.count(children) - 1)) * 100
}
color={color}
/>
<Dots
activeStep={activeStep}
labels={React.Children.map(children, child => child.props.label)}
color={color}
/>
</LineWrapper>
{React.Children.toArray(children)[activeStep]}
</Root>
);
};

Stepper.displayName = 'Stepper';

Expand Down

0 comments on commit 51353b0

Please sign in to comment.