From 21943daa77ec26828d79f76b67f6e5b218b8003c Mon Sep 17 00:00:00 2001 From: Oleksandra Okhotnykova Date: Thu, 22 Aug 2024 18:53:12 +0200 Subject: [PATCH] OV-38: + reusable icon component --- .../components/video-card/icon-component.tsx | 58 +++++++++++++++++++ .../home/components/video-card/video-card.tsx | 44 +++++++------- 2 files changed, 79 insertions(+), 23 deletions(-) create mode 100644 frontend/src/bundles/home/components/video-card/icon-component.tsx diff --git a/frontend/src/bundles/home/components/video-card/icon-component.tsx b/frontend/src/bundles/home/components/video-card/icon-component.tsx new file mode 100644 index 000000000..ec0f9da01 --- /dev/null +++ b/frontend/src/bundles/home/components/video-card/icon-component.tsx @@ -0,0 +1,58 @@ +import { Flex, Icon } from '@chakra-ui/react'; +import { type IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + +type Properties = { + icon: IconDefinition; + buttonSize: string; + iconSize: string; + horizontalPosition: 'left' | 'right'; + horizontalPositionValue: string; + top: string; + transform?: string; + backgroundColor?: string; + borderRadius?: string; +}; + +const IconComponent: React.FC = ({ + icon, + buttonSize, + iconSize, + horizontalPosition, + horizontalPositionValue, + top, + transform = '', + backgroundColor = 'white', + borderRadius = '0', +}) => { + const isLeft = horizontalPosition === 'left'; + + return ( + + + + ); +}; + +export { IconComponent }; diff --git a/frontend/src/bundles/home/components/video-card/video-card.tsx b/frontend/src/bundles/home/components/video-card/video-card.tsx index 15a466020..1de230cbe 100644 --- a/frontend/src/bundles/home/components/video-card/video-card.tsx +++ b/frontend/src/bundles/home/components/video-card/video-card.tsx @@ -1,9 +1,10 @@ -import { Box, Flex, Icon, Image, Text } from '@chakra-ui/react'; -import { faPen } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { Box, Flex, Image, Text } from '@chakra-ui/react'; +import { faEllipsisVertical, faPen } from '@fortawesome/free-solid-svg-icons'; import photo from '~/assets/img/photo.png'; +import { IconComponent } from './icon-component.js'; + const VideoCard: React.FC = () => { return ( <> @@ -25,29 +26,26 @@ const VideoCard: React.FC = () => { borderRadius="5px" /> - - - + /> + +