-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39a50f8
commit 21943da
Showing
2 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
frontend/src/bundles/home/components/video-card/icon-component.tsx
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,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<Properties> = ({ | ||
icon, | ||
buttonSize, | ||
iconSize, | ||
horizontalPosition, | ||
horizontalPositionValue, | ||
top, | ||
transform = '', | ||
backgroundColor = 'white', | ||
borderRadius = '0', | ||
}) => { | ||
const isLeft = horizontalPosition === 'left'; | ||
|
||
return ( | ||
<Flex | ||
position="absolute" | ||
top={top} | ||
right={isLeft ? 'auto' : horizontalPositionValue} | ||
left={isLeft ? horizontalPositionValue : 'auto'} | ||
transform={transform} | ||
backgroundColor={backgroundColor} | ||
borderRadius={borderRadius} | ||
w={buttonSize} | ||
h={buttonSize} | ||
alignItems="center" | ||
justifyContent="center" | ||
opacity="0" | ||
transition="opacity 0.3s ease" | ||
_groupHover={{ opacity: 1 }} | ||
> | ||
<Icon | ||
as={FontAwesomeIcon} | ||
icon={icon} | ||
height={iconSize} | ||
width={iconSize} | ||
color="background.600" | ||
/> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export { IconComponent }; |
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