-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OV-18: add videomodal component #36
Changes from 20 commits
af7193f
3a737fe
2faab74
d2340b6
fe050ed
64162de
d9b5c99
393710b
9da3d92
aadc9dc
742e62a
0dbf2ce
68796b7
d2bec02
a6158d4
8270db9
be2a8fd
ff65ee3
e7f992f
a957cdc
6189c42
3b48a9e
0c3c35a
6f03027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { VideoModalContent } from './video-modal-content/video-modal-content.js'; |
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'; |
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 }; |
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'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const VideoPreview = { | ||
PORTRAIT: 'portrait', | ||
LANDSCAPE: 'landscape', | ||
} as const; | ||
|
||
export { VideoPreview }; |
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 }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { type VideoPreview } from './video-preview.type.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type VideoPreview = 'portrait' | 'landscape'; | ||
|
||
export { type VideoPreview }; |
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 setPortraitView = useCallback((): void => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
A10 https://github.com/BinaryStudioAcademy/quality-criteria/blob/production/src/javascript.md |
||||||
setView(VideoPreviewValues.PORTRAIT); | ||||||
}, []); | ||||||
|
||||||
const setLandscapeView = useCallback((): void => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||||||
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> | ||||||
{view === VideoPreviewValues.PORTRAIT | ||||||
? VideoSizeLabel.PORTRAIT | ||||||
: VideoSizeLabel.LANDSCAPE} | ||||||
</Text> | ||||||
</Flex> | ||||||
</Flex> | ||||||
|
||||||
<Flex justifyContent="center" gap={4}> | ||||||
<Button | ||||||
backgroundColor="brand.secondary.300" | ||||||
color="white" | ||||||
onMouseEnter={setLandscapeView} | ||||||
_hover={{ bg: 'brand.secondary.600' }} | ||||||
> | ||||||
Use landscape | ||||||
</Button> | ||||||
<Button | ||||||
backgroundColor="brand.secondary.300" | ||||||
color="white" | ||||||
onMouseEnter={setPortraitView} | ||||||
_hover={{ bg: 'brand.secondary.600' }} | ||||||
> | ||||||
Use portrait | ||||||
</Button> | ||||||
</Flex> | ||||||
</Flex> | ||||||
); | ||||||
}; | ||||||
|
||||||
export { VideoPreview }; |
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 }; |
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 './libs/components/components.js'; | ||||||
|
||||||
type Properties = { | ||||||
isOpen: boolean; | ||||||
closeModal: () => void; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
https://github.com/BinaryStudioAcademy/quality-criteria/blob/production/src/javascript.md A9 |
||||||
}; | ||||||
|
||||||
const VideoModal = ({ isOpen, closeModal }: Properties): JSX.Element => { | ||||||
return ( | ||||||
<Modal isOpen={isOpen} onClose={closeModal} 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need
libs
folder