Skip to content

Commit

Permalink
Merge pull request #57 from BinaryStudioAcademy/task/OV-38-add-homepage
Browse files Browse the repository at this point in the history
OV-38: Add homepage
  • Loading branch information
nikita-remeslov authored Aug 28, 2024
2 parents 4cfe5e7 + ab5375d commit 90a4422
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 1 deletion.
Binary file added frontend/src/assets/img/photo.png
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/src/bundles/common/components/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { VideoModal } from './video-modal/video-modal.js';
export { DownloadIcon } from '@chakra-ui/icons';
export { ViewIcon, ViewOffIcon } from '@chakra-ui/icons';
export {
Badge,
Box,
Center,
Circle,
Expand All @@ -18,7 +19,9 @@ export {
FormControl,
FormErrorMessage,
Heading,
Icon,
IconButton,
Image,
InputGroup,
InputRightElement,
SimpleGrid,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/bundles/common/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Header: React.FC<Properties> = ({ left, center, right }) => {
boxShadow="md"
zIndex="1000"
padding="4"
marginBottom="20px"
alignItems="center"
justifyContent="space-between"
>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/bundles/common/icons/icon-name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { faEllipsisVertical, faPen } from '@fortawesome/free-solid-svg-icons';

const IconName = {
OPTIONS_VERTICAL: faEllipsisVertical,
PEN: faPen,
} as const;

export { IconName };
1 change: 1 addition & 0 deletions frontend/src/bundles/common/icons/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { IconName } from './icon-name.js';
3 changes: 3 additions & 0 deletions frontend/src/bundles/home/components/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { MainContent } from './main-content/main-content.js';
export { VideoCard } from './video-card/video-card.js';
export { VideoSection } from './video-section/video-section.js';
14 changes: 14 additions & 0 deletions frontend/src/bundles/home/components/main-content/main-content.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Box } from '~/bundles/common/components/components.js';

import { VideoSection } from '../components.js';

const MainContent: React.FC = () => {
return (
<Box bg="background.50" borderRadius="lg" margin="0 25px">
<VideoSection />
<VideoSection />
</Box>
);
};

export { MainContent };
92 changes: 92 additions & 0 deletions frontend/src/bundles/home/components/video-card/video-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import photo from '~/assets/img/photo.png';
import {
Box,
Flex,
Icon,
IconButton,
Image,
Text,
} from '~/bundles/common/components/components.js';
import { IconName } from '~/bundles/common/icons/icons.js';

const VideoCard: React.FC = () => {
return (
<Box borderRadius="8px" bg="white" padding="7px">
<Box position="relative" role="group">
<Image src={photo} alt="Video preview" borderRadius="5px" />

{/* Overlay effect */}
<Box
position="absolute"
top="0"
left="0"
width="100%"
height="100%"
bg="rgba(53, 57, 154, 0.3)"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
borderRadius="5px"
/>

<IconButton
aria-label="Video options"
position="absolute"
bg="white"
top="5px"
right="5px"
size="xs"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
icon={
<Icon
as={FontAwesomeIcon}
icon={IconName.OPTIONS_VERTICAL}
color="background.600"
/>
}
/>

<IconButton
aria-label="Edit video"
isRound={true}
size="lg"
position="absolute"
bg="white"
top="50%"
left="calc(50% - 12.5px)"
transform="translate(-50%, -50%)"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
icon={
<Icon
as={FontAwesomeIcon}
icon={IconName.PEN}
color="background.600"
/>
}
/>
</Box>

<Box padding="7px 10px 5px 5px">
<Text variant="button" color="typography.900">
Video Name
</Text>
<Flex justify="space-between">
<Text variant="caption" color="typography.300">
Aug 9, 2024, 1:24 PM
</Text>
<Text variant="caption" color="typography.300">
0,30 sec
</Text>
</Flex>
</Box>
</Box>
);
};

export { VideoCard };
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Badge,
Box,
Flex,
Heading,
SimpleGrid,
} from '~/bundles/common/components/components.js';

import { VideoCard } from '../components.js';

const VideoSection: React.FC = () => {
return (
<Box padding="17px 28px">
<Flex alignItems="center" marginBottom="9px">
<Heading color="typography.900" variant="H3" marginRight="11px">
Videos
</Heading>
<Badge
color="background.600"
bg="#D1D4DB"
fontWeight="400"
padding="2px 10px"
>
23
</Badge>
</Flex>
<SimpleGrid minChildWidth="253px" spacing="20px">
{/* TODO: Update this mocked data */}
<VideoCard />
<VideoCard />
<VideoCard />
<VideoCard />
<VideoCard />
</SimpleGrid>
</Box>
);
};

export { VideoSection };
15 changes: 15 additions & 0 deletions frontend/src/bundles/home/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Box, Header } from '~/bundles/common/components/components.js';

import { MainContent } from '../components/components.js';

const Home: React.FC = () => {
return (
<Box bg="background.900" height="100vh">
<Header />
{/* Sidebar */}
<MainContent />
</Box>
);
};

export { Home };
5 changes: 5 additions & 0 deletions frontend/src/router/routes/protected-routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Navigate } from 'react-router-dom';

import { AppRoute } from '~/bundles/common/enums/app-route.enum.js';
import { Home } from '~/bundles/home/pages/home.js';
import { Studio } from '~/bundles/studio/pages/studio.js';

import { ProtectedRoute } from '../components/protected-route.js';
Expand All @@ -10,6 +11,10 @@ const protectedRoutes = {
element: <ProtectedRoute />,
children: [
//TODO Add protected routes here in element property and specify the correct path
{
path: AppRoute.ROOT,
element: <Home />,
},
{
path: AppRoute.STUDIO,
element: <Studio />,
Expand Down

0 comments on commit 90a4422

Please sign in to comment.