-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created initial page layouts, added branding and updated tests from b…
…oilerplate Created required reusable components Set-up API calls to required endpoints Deleted components which were not required for test
- Loading branch information
1 parent
b669ab4
commit c9ff9e2
Showing
38 changed files
with
1,154 additions
and
158 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* A React component that renders a card displaying details about a sensor, including its name, value, and unit. | ||
* | ||
* @param {DeviceSensorDetailsProps} props - The props for the component. | ||
* @param {string} props.detailTitle - The title of the sensor detail. | ||
* @param {string} props.value - The value of the sensor. | ||
* @param {string} props.iconSrc - The source of the icon to display. | ||
* @param {string} props.iconAlt - The alt text for the icon. | ||
* @returns {JSX.Element} - The rendered sensor detail card. | ||
*/ | ||
import { HStack, Img, Skeleton, Text, VStack } from "@chakra-ui/react"; | ||
|
||
type DeviceSensorDetailsProps = { | ||
detailTitle: string; | ||
value: string; | ||
iconSrc: string; | ||
iconAlt: string; | ||
}; | ||
const DeviceSensorDetails = ({ | ||
detailTitle, | ||
value, | ||
iconSrc, | ||
iconAlt, | ||
}: DeviceSensorDetailsProps) => { | ||
if (!value) { | ||
return <Skeleton />; | ||
} | ||
return ( | ||
<VStack | ||
textAlign="left" | ||
spacing="0" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
> | ||
<Text fontSize="xs" color="gray.400"> | ||
{detailTitle} | ||
</Text> | ||
<Text fontSize="sm" color="black"> | ||
<HStack spacing="2" justifyContent="flex-start"> | ||
<Img src={iconSrc} alt={iconAlt} width="15px" /> | ||
<Text width="full" fontSize="xs"> | ||
{value} | ||
</Text> | ||
</HStack> | ||
</Text> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default DeviceSensorDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Skeleton, Text, VStack } from "@chakra-ui/react"; | ||
|
||
type DeviceDetailCardProps = { | ||
detailTitle: string; | ||
value: string; | ||
}; | ||
|
||
const DeviceStatusDetails = ({ detailTitle, value }: DeviceDetailCardProps) => { | ||
if (!value) { | ||
return <Skeleton />; | ||
} | ||
return ( | ||
<VStack | ||
textAlign="left" | ||
spacing="0" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
> | ||
<Text fontSize="xs" color="gray.400"> | ||
{detailTitle} | ||
</Text> | ||
<Text fontSize="xs">{value}</Text> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default DeviceStatusDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import DeviceSensorDetails from "./deviceSensorDetails"; | ||
import DeviceStatusDetails from "./deviceStatusDetails"; | ||
|
||
export { DeviceSensorDetails, DeviceStatusDetails }; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Input, InputGroup, InputLeftElement } from "@chakra-ui/react"; | ||
import { BiSearch } from "react-icons/bi"; | ||
|
||
const TextSearch = () => { | ||
return ( | ||
<InputGroup> | ||
<InputLeftElement pointerEvents="none"> | ||
<BiSearch color="gray.300" /> | ||
</InputLeftElement> | ||
<Input | ||
type="text" | ||
maxWidth="600px" | ||
placeholder="Search Devices" | ||
backgroundColor="gray.200" | ||
/> | ||
</InputGroup> | ||
); | ||
}; | ||
|
||
export default TextSearch; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import { Flex, Text } from "@chakra-ui/react"; | ||
/** | ||
* Renders a header component with a title, page icon, and descriptive text. | ||
* | ||
* @param {HeaderProps} props - The props for the header component. | ||
* @param {string} props.title - The title to display in the header. | ||
* @returns {JSX.Element} The rendered header component. | ||
*/ | ||
import { Text } from "@chakra-ui/react"; | ||
|
||
import ThemeButton from "../ThemeButton"; | ||
import { devicesPage } from "~/constants/branding/pages"; | ||
import { PageHeader } from "./pageHeader"; | ||
|
||
interface HeaderProps { | ||
title: string; | ||
} | ||
|
||
export default function Header({ title }: HeaderProps) { | ||
return ( | ||
<Flex justifyContent="space-between"> | ||
<Flex /> | ||
<Text data-cy="title-header">{title}</Text> | ||
<ThemeButton aria-label="Toggle light-dark mode" /> | ||
</Flex> | ||
<PageHeader | ||
header={<Text>{title || devicesPage.name}</Text>} | ||
pageIcon={devicesPage.icon} | ||
pageDescription={devicesPage.descriptiveText} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { HStack, Img, Heading, IconButton } from "@chakra-ui/react"; | ||
|
||
type PageContentContainerProps = { | ||
header: React.ReactNode; | ||
pageIcon: string; | ||
pageDescription: string; | ||
}; | ||
|
||
const PageHeader = ({ | ||
header, | ||
pageIcon, | ||
pageDescription, | ||
}: PageContentContainerProps) => { | ||
return ( | ||
<HStack width="full" justifyContent="space-between"> | ||
<HStack width="auto" alignContent="baseline" spacing="2" paddingY="4"> | ||
<Img src={pageIcon} alt={pageDescription} width="40px" height="40px" /> | ||
<Heading as="h1" size="md" data-cy="title-header"> | ||
{header} | ||
</Heading> | ||
</HStack> | ||
<HStack width="auto"> | ||
<IconButton | ||
isDisabled | ||
aria-label="Notifications" | ||
icon={ | ||
<Img | ||
width="16px" | ||
height="19px" | ||
src="/icons/icon-notification-bell.svg" | ||
alt="Notifications" | ||
/> | ||
} | ||
/> | ||
<IconButton | ||
isDisabled | ||
aria-label="Apps" | ||
icon={ | ||
<Img | ||
width="16px" | ||
height="16px" | ||
src="/icons/icon-apps.svg" | ||
alt="Apps" | ||
/> | ||
} | ||
/> | ||
<IconButton | ||
isDisabled | ||
aria-label="Account" | ||
icon={ | ||
<Img | ||
width="20px" | ||
height="20px" | ||
src="/icons/icon-account--circle.svg" | ||
alt="Account" | ||
/> | ||
} | ||
/> | ||
</HStack> | ||
</HStack> | ||
); | ||
}; | ||
|
||
export { PageHeader }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* `PageContentContainer` is a React component that provides a layout for a page content area. It includes a header with a page icon, title, and some action buttons, as well as a side navigation component and the main content area. | ||
* | ||
* @param {object} props - The component props. | ||
* @param {React.ReactNode} props.header - The header content for the page. | ||
* @param {React.ReactNode} props.children - The main content for the page. | ||
* @param {string} props.pageIcon - The URL of the page icon image. | ||
* @param {string} props.pageDescription - A description of the page, used as the alt text for the page icon. | ||
* @returns {React.ReactElement} - The `PageContentContainer` component. | ||
*/ | ||
import { HStack, VStack } from "@chakra-ui/react"; | ||
import React from "react"; | ||
import SideNav from "../Sidenav"; | ||
|
||
type PageContentContainerProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
const PageContentContainer = ({ children }: PageContentContainerProps) => { | ||
return ( | ||
<VStack width="100%" p={0} paddingX="4" alignItems="flex-start"> | ||
<HStack | ||
width="full" | ||
height="100vh" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
overflow="hidden" | ||
spacing="0" | ||
> | ||
<SideNav /> | ||
<VStack | ||
justifyContent="flex-start" | ||
padding="0" | ||
alignItems="flex-start" | ||
width="full" | ||
height="100vh" | ||
> | ||
{children} | ||
</VStack> | ||
</HStack> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default PageContentContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* The `SideNav` component represents the side navigation bar in the application. | ||
* It contains the main navigation links and the logo with the sign-out container. | ||
* The component is responsible for rendering the side navigation UI and managing its layout. | ||
*/ | ||
import { VStack } from "@chakra-ui/react"; | ||
|
||
import { LogoWithSignoutContainer } from "./logoSignoutContainer"; | ||
import { MainNavigation } from "./mainNavigation"; | ||
|
||
const SideNav = () => { | ||
return ( | ||
<VStack | ||
width="340px" | ||
height="calc(100vh - 100px)" | ||
justifyContent="space-between" | ||
alignItems="space-between" | ||
> | ||
<MainNavigation /> | ||
<LogoWithSignoutContainer /> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default SideNav; |
Oops, something went wrong.