Skip to content

Commit

Permalink
change title and icon base on step
Browse files Browse the repository at this point in the history
  • Loading branch information
alonkeyval committed Jul 12, 2023
1 parent a828ab4 commit d833ba1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
20 changes: 20 additions & 0 deletions frontend/webapp/assets/icons/connect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 29 additions & 8 deletions frontend/webapp/containers/setup/setup.header/setup.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,41 @@ import {
} from "./setup.header.styled";
import { KeyvalButton, KeyvalText } from "@/design.system";
import Charge from "assets/icons/charge-rect.svg";
import Connect from "assets/icons/connect.svg";
import RightArrow from "assets/icons/arrow-right.svg";
import { SETUP } from "@/utils/constants";

export function SetupHeader({ onNextClick, totalSelected }: any) {
export function SetupHeader({ currentStep, onNextClick, totalSelected }: any) {
function renderCurrentIcon() {
switch (currentStep?.id) {
case "choose-source":
return (
<>
<Charge />
<KeyvalText>{SETUP.HEADER.CHOOSE_SOURCE_TITLE}</KeyvalText>
</>
);
case "choose-destination":
return (
<>
<Connect />
<KeyvalText>{SETUP.HEADER.CHOOSE_DESTINATION_TITLE}</KeyvalText>
</>
);
default:
return null;
}
}

return (
<SetupHeaderWrapper>
<HeaderTitleWrapper>
<Charge />
<KeyvalText>{SETUP.HEADER.CHOOSE_SOURCE_TITLE}</KeyvalText>
</HeaderTitleWrapper>
<HeaderTitleWrapper>{renderCurrentIcon()}</HeaderTitleWrapper>
<HeaderButtonWrapper>
<KeyvalText
weight={400}
>{`${totalSelected} ${SETUP.SELECTED}`}</KeyvalText>
{currentStep?.id === "choose-source" && (
<KeyvalText
weight={400}
>{`${totalSelected} ${SETUP.SELECTED}`}</KeyvalText>
)}
<KeyvalButton
disabled={totalSelected === 0}
onClick={onNextClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
StepListWrapper,
} from "./setup.section.styled";
import { SetupHeader } from "../setup.header/setup.header";
import { setNamespaces } from "@/services/setup";
import { SETUP } from "@/utils/constants";
import Steps from "@/design.system/steps/steps";
import { SourcesSection } from "../sources/sources.section";
Expand Down Expand Up @@ -66,6 +65,7 @@ export function SetupSection() {
function handleNamespacesUpdate() {
// setNamespaces(sectionData);
setCurrentStep(STEPS[1]);
setSectionData({});
}

function onNextClick() {
Expand All @@ -83,7 +83,11 @@ export function SetupSection() {
<Steps data={steps} />
</StepListWrapper>
<SetupSectionContainer>
<SetupHeader onNextClick={onNextClick} totalSelected={totalSelected} />
<SetupHeader
currentStep={currentStep}
onNextClick={onNextClick}
totalSelected={totalSelected}
/>
<SetupContentWrapper>{renderCurrentSection()}</SetupContentWrapper>
</SetupSectionContainer>
</>
Expand Down
1 change: 1 addition & 0 deletions frontend/webapp/utils/constants/string.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const SETUP = {
},
HEADER: {
CHOOSE_SOURCE_TITLE: "Select applications to connect",
CHOOSE_DESTINATION_TITLE: "Add new backend destination from the list",
},
MENU: {
NAMESPACES: "Namespaces",
Expand Down

0 comments on commit d833ba1

Please sign in to comment.