-
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.
Merge pull request #36 from BinaryStudioAcademy/task/OV-18-add-videom…
…odal OV-18: add videomodal component
- Loading branch information
Showing
14 changed files
with
263 additions
and
0 deletions.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
frontend/src/bundles/common/components/video-modal/components/components.ts
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 @@ | ||
export { VideoModalContent } from './video-modal-content/video-modal-content.js'; |
2 changes: 2 additions & 0 deletions
2
...les/common/components/video-modal/components/video-modal-content/components/components.ts
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,2 @@ | ||
export { Tab } from './tab/tab.js'; | ||
export { VideoPreview } from './video-preview/video-preview.js'; |
29 changes: 29 additions & 0 deletions
29
...ndles/common/components/video-modal/components/video-modal-content/components/tab/tab.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,29 @@ | ||
import { Icon, Tab as ChakraTab } from '@chakra-ui/react'; | ||
import { type IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
|
||
type Properties = { | ||
label: string; | ||
icon: IconDefinition; | ||
}; | ||
|
||
const Tab = ({ label, icon }: Properties): JSX.Element => { | ||
return ( | ||
<ChakraTab | ||
justifyContent="stretch" | ||
borderRadius="10px" | ||
textAlign="left" | ||
_selected={{ backgroundColor: 'gray.300' }} | ||
> | ||
<Icon | ||
as={FontAwesomeIcon} | ||
icon={icon} | ||
padding="5px" | ||
height="16px" | ||
/>{' '} | ||
{label} | ||
</ChakraTab> | ||
); | ||
}; | ||
|
||
export { Tab }; |
2 changes: 2 additions & 0 deletions
2
...s/video-modal/components/video-modal-content/components/video-preview/libs/enums/enums.ts
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,2 @@ | ||
export { VideoPreview } from './video-preview.enum.js'; | ||
export { VideoSizeLabel } from './video-sizes.enum.js'; |
6 changes: 6 additions & 0 deletions
6
.../components/video-modal-content/components/video-preview/libs/enums/video-preview.enum.ts
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,6 @@ | ||
const VideoPreview = { | ||
PORTRAIT: 'portrait', | ||
LANDSCAPE: 'landscape', | ||
} as const; | ||
|
||
export { VideoPreview }; |
6 changes: 6 additions & 0 deletions
6
...al/components/video-modal-content/components/video-preview/libs/enums/video-sizes.enum.ts
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,6 @@ | ||
const VideoSizeLabel = { | ||
PORTRAIT: '1080 x 1920', | ||
LANDSCAPE: '1920 x 1080', | ||
} as const; | ||
|
||
export { VideoSizeLabel }; |
1 change: 1 addition & 0 deletions
1
...s/video-modal/components/video-modal-content/components/video-preview/libs/types/types.ts
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 @@ | ||
export { type VideoPreview } from './video-preview.type.js'; |
3 changes: 3 additions & 0 deletions
3
.../components/video-modal-content/components/video-preview/libs/types/video-preview.type.ts
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,3 @@ | ||
type VideoPreview = 'portrait' | 'landscape'; | ||
|
||
export { type VideoPreview }; |
78 changes: 78 additions & 0 deletions
78
...nts/video-modal/components/video-modal-content/components/video-preview/video-preview.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,78 @@ | ||
import { Button, Flex, Icon, Text } from '@chakra-ui/react'; | ||
import { faPlay } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { useCallback, useState } from 'react'; | ||
|
||
import { | ||
VideoPreview as VideoPreviewValues, | ||
VideoSizeLabel, | ||
} from './libs/enums/enums.js'; | ||
import { type VideoPreview as VideoPreviewType } from './libs/types/types.js'; | ||
|
||
const VideoPreview = (): JSX.Element => { | ||
const [view, setView] = useState<VideoPreviewType>( | ||
VideoPreviewValues.PORTRAIT, | ||
); | ||
|
||
const handleSetPortraitView = useCallback((): void => { | ||
setView(VideoPreviewValues.PORTRAIT); | ||
}, []); | ||
|
||
const handleSetLandscapeView = useCallback((): void => { | ||
setView(VideoPreviewValues.LANDSCAPE); | ||
}, []); | ||
|
||
return ( | ||
<Flex flexDirection="column" alignItems="center"> | ||
<Flex | ||
width={view === VideoPreviewValues.PORTRAIT ? '250px' : '720px'} | ||
height="444px" | ||
borderWidth="1px" | ||
borderColor="gray.300" | ||
borderRadius="md" | ||
justifyContent="center" | ||
alignItems="center" | ||
mb={4} | ||
> | ||
<Flex | ||
flexDirection="column" | ||
alignItems="center" | ||
color="gray.400" | ||
> | ||
<Icon | ||
as={FontAwesomeIcon} | ||
icon={faPlay} | ||
padding="5px" | ||
height="16px" | ||
/> | ||
<Text color="gray.400"> | ||
{view === VideoPreviewValues.PORTRAIT | ||
? VideoSizeLabel.PORTRAIT | ||
: VideoSizeLabel.LANDSCAPE} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
|
||
<Flex justifyContent="center" gap={4}> | ||
<Button | ||
backgroundColor="brand.secondary.300" | ||
color="white" | ||
onMouseEnter={handleSetLandscapeView} | ||
_hover={{ bg: 'brand.secondary.600' }} | ||
> | ||
Use landscape | ||
</Button> | ||
<Button | ||
backgroundColor="brand.secondary.300" | ||
color="white" | ||
onMouseEnter={handleSetPortraitView} | ||
_hover={{ bg: 'brand.secondary.600' }} | ||
> | ||
Use portrait | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export { VideoPreview }; |
29 changes: 29 additions & 0 deletions
29
...dles/common/components/video-modal/components/video-modal-content/video-modal-content.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,29 @@ | ||
import { TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'; | ||
import { faPlay } from '@fortawesome/free-solid-svg-icons/faPlay'; | ||
|
||
import { Tab, VideoPreview } from './components/components.js'; | ||
|
||
const VideoModalContent = (): JSX.Element => { | ||
return ( | ||
<Tabs orientation="vertical" variant="unstyled" height="full"> | ||
<TabList | ||
backgroundColor="gray.100" | ||
padding="20px 20px 20px" | ||
minWidth="290px" | ||
> | ||
<Tab icon={faPlay} label="Start from scratch" /> | ||
</TabList> | ||
<TabPanels | ||
display="flex" | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
<TabPanel> | ||
<VideoPreview /> | ||
</TabPanel> | ||
</TabPanels> | ||
</Tabs> | ||
); | ||
}; | ||
|
||
export { VideoModalContent }; |
44 changes: 44 additions & 0 deletions
44
frontend/src/bundles/common/components/video-modal/video-modal.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,44 @@ | ||
import { | ||
Modal, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalHeader, | ||
ModalOverlay, | ||
} from '@chakra-ui/react'; | ||
|
||
import { VideoModalContent } from './components/components.js'; | ||
|
||
type Properties = { | ||
isOpen: boolean; | ||
onModalClose: () => void; | ||
}; | ||
|
||
const VideoModal = ({ isOpen, onModalClose }: Properties): JSX.Element => { | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onModalClose} isCentered> | ||
<ModalOverlay /> | ||
<ModalContent | ||
borderRadius="17px" | ||
maxWidth="90%" | ||
maxHeight="90%" | ||
height="full" | ||
overflow="auto" | ||
> | ||
<ModalHeader | ||
backgroundColor="gray.100" | ||
width="290px" | ||
padding="33px 44px 0px" | ||
> | ||
Create video | ||
</ModalHeader> | ||
<ModalCloseButton margin="20px" /> | ||
<ModalBody padding="0px"> | ||
<VideoModalContent /> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export { VideoModal }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.