Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alonkeyval committed Jul 23, 2023
1 parent e202d5c commit b610fad
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 4 deletions.
6 changes: 6 additions & 0 deletions frontend/webapp/app/overview/sources/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use client";
import React from "react";

export default function SourcesOverviewPage() {
return <div>SourcesOverviewPage</div>;
}
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/destinations-focus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/destinations-unfocus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/focus-overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/sources-focus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/sources-unfocus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/unfocus-overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions frontend/webapp/components/side.menu/menu.item/menu.item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { KeyvalText } from "@/design.system";
import React from "react";
import { styled } from "styled-components";
interface MenuItemContainerProps {
focused: boolean;
}

interface MenuItem {
name: string;
icons: {
focus: () => JSX.Element;
notFocus: () => JSX.Element;
};
}

interface MenuItemProps {
item: MenuItem;
focused: boolean;
onClick?: () => void;
}

const MenuItemContainer = styled.div<MenuItemContainerProps>`
display: flex;
padding: 0px 16px;
height: 48px;
align-items: center;
gap: 10px;
cursor: pointer;
border-radius: 10px;
background: ${({ focused, theme }) =>
focused ? theme.colors.blue_grey : "transparent"};
`;

export default function MenuItem({ item, focused, onClick }: MenuItemProps) {
const { name, icons } = item;

return (
<MenuItemContainer onClick={onClick} focused={focused}>
{focused ? icons.focus() : icons.notFocus()}
<KeyvalText size={14} weight={600}>
{name}
</KeyvalText>
</MenuItemContainer>
);
}
7 changes: 7 additions & 0 deletions frontend/webapp/components/side.menu/menu/menu.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ export const MenuContainer = styled.div`
border-right: 1px solid rgba(255, 255, 255, 0.04);
background: ${({ theme }) => theme.colors.dark_blue};
`;
export const LogoWrapper = styled.div`
padding: 24px 16px;
`;

export const MenuItemsWrapper = styled.div`
padding: 16px 9px;
`;
75 changes: 72 additions & 3 deletions frontend/webapp/components/side.menu/menu/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,75 @@
"use client";
import React from "react";
import { MenuContainer } from "./menu.styled";
import React, { useState } from "react";
import { MenuContainer, LogoWrapper, MenuItemsWrapper } from "./menu.styled";
import { KeyvalText } from "@/design.system";
import MenuItem from "../menu.item/menu.item";
import { useRouter } from "next/navigation";

import FocusOverview from "../../../assets/icons/focus-overview.svg";
import UnFocusOverview from "../../../assets/icons/unfocus-overview.svg";
import FocusSources from "../../../assets/icons/sources-focus.svg";
import UnFocusSources from "../../../assets/icons/sources-unfocus.svg";
import FocusDestinations from "../../../assets/icons/destinations-focus.svg";
import UnFocusDestinations from "../../../assets/icons/destinations-unfocus.svg";
import { OVERVIEW } from "@/utils/constants";
const MENU_ITEMS = [
{
id: 1,
name: "Overview",
icons: {
focus: () => <FocusOverview />,
notFocus: () => <UnFocusOverview />,
},
navigate: "/overview",
},
{
id: 2,
name: "Sources",
icons: {
focus: () => <FocusSources />,
notFocus: () => <UnFocusSources />,
},
navigate: "/overview/sources",
},
{
id: 3,
name: "Destinations",
icons: {
focus: () => <FocusDestinations />,
notFocus: () => <UnFocusDestinations />,
},
navigate: "/overview/destinations",
},
];

export function Menu() {
return <MenuContainer></MenuContainer>;
const [currentMenuItem, setCurrentMenuItem] = useState(MENU_ITEMS[0]);
const router = useRouter();

function handleMenuItemClick(item) {
setCurrentMenuItem(item);
router.push(item?.navigate);
}

function renderMenuItemsList() {
return MENU_ITEMS.map((item) => (
<MenuItem
key={`${item.id}_${item.name}`}
onClick={() => handleMenuItemClick(item)}
focused={currentMenuItem?.id === item.id}
item={item}
/>
));
}

return (
<MenuContainer>
<LogoWrapper>
<KeyvalText size={32} weight={700}>
{OVERVIEW.ODIGOS}
</KeyvalText>
</LogoWrapper>
<MenuItemsWrapper>{renderMenuItemsList()}</MenuItemsWrapper>
</MenuContainer>
);
}
2 changes: 1 addition & 1 deletion frontend/webapp/utils/constants/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { ROUTES } from "./routes";
export { CONFIG } from "./config";
export { SETUP } from "./string";
export { SETUP, OVERVIEW } from "./string";
export { API, QUERIES } from "./urls";
4 changes: 4 additions & 0 deletions frontend/webapp/utils/constants/string.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ export const SETUP = {
SELECTED: "Selected",
MANAGED: "Managed",
};

export const OVERVIEW = {
ODIGOS: "Odigos",
};

0 comments on commit b610fad

Please sign in to comment.