Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fix for Stepper component #667

Merged
merged 3 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/lib/components/steppers/Stepper.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export const Stepper: Stepper = ({ steps }) => {

return (
<StepperContext.Provider value={{ next, prev }}>
<Box display={'flex'} gap={32} padding={32} flex={1}>

<Box display="flex" gap={32} flex={1} height="100%">
<Steppers
activeStep={stepProps.step}
steps={steps.map((step) => {
Expand Down
20 changes: 15 additions & 5 deletions src/lib/components/steppers/Steppers.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ type Props = {
steps: Array<StepProps>;
activeStep: number;
};
const SteppersContainer = styled.div``;
const SteppersContainer = styled.div`
padding-top: 4rem;
padding-left: 2rem;
`;
const StepContainer = styled.div`
display: flex;
min-height: 50px;
min-width: 20rem;
`;
const Panel = styled.div`
display: flex;
Expand Down Expand Up @@ -59,15 +63,18 @@ const Circle = styled.div`
`;
} else {
return css`
background-color: ${defaultTheme.gray};
background-color: ${getThemePropSelector('buttonSecondary')};
color: ${defaultTheme.white};
`;
}
}};
`;
const StepHeader = styled.span`
padding: 8px;
color: ${getThemePropSelector('textPrimary')};
color: ${(props) =>
props.active
? getThemePropSelector('textPrimary')
: getThemePropSelector('textSecondary')};
`;
const StepContent = styled.div`
padding: ${defaultTheme.padding.small};
Expand All @@ -76,7 +83,7 @@ const BottomBar = styled.hr`
flex-grow: 1;
margin: 0;
border: none;
margin: 2px 14px;
margin: 4px 14px;

${(props) => {
if (props.completed) {
Expand All @@ -103,6 +110,7 @@ function Step(props: StepProps) {
inProgress,
} = props;
const circleContent = completed ? <Icon name="Check" /> : index + 1;

return (
<StepContainer>
<Panel>
Expand All @@ -116,7 +124,9 @@ function Step(props: StepProps) {
{!isLast && <BottomBar completed={completed} />}
</Panel>
<Panel>
<StepHeader completed={completed}>{title}</StepHeader>
<StepHeader completed={completed} active={active}>
{title}
</StepHeader>
{active && <StepContent>{content}</StepContent>}
</Panel>
</StepContainer>
Expand Down
Loading