-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
13 changed files
with
291 additions
and
44 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
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,38 +1,11 @@ | ||
import * as React from "react" | ||
import { | ||
ChakraProvider, | ||
Box, | ||
Text, | ||
Link, | ||
VStack, | ||
Code, | ||
Grid, | ||
theme, | ||
} from "@chakra-ui/react" | ||
import { ColorModeSwitcher } from "./ColorModeSwitcher" | ||
import { Logo } from "./Logo" | ||
import { ChakraProvider, theme } from "@chakra-ui/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import Router from "./Router"; | ||
|
||
export const App = () => ( | ||
<ChakraProvider theme={theme}> | ||
<Box textAlign="center" fontSize="xl"> | ||
<Grid minH="100vh" p={3}> | ||
<ColorModeSwitcher justifySelf="flex-end" /> | ||
<VStack spacing={8}> | ||
<Logo h="40vmin" pointerEvents="none" /> | ||
<Text> | ||
Edit <Code fontSize="xl">src/App.tsx</Code> and save to reload. | ||
</Text> | ||
<Link | ||
color="teal.500" | ||
href="https://chakra-ui.com" | ||
fontSize="2xl" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn Chakra | ||
</Link> | ||
</VStack> | ||
</Grid> | ||
</Box> | ||
<BrowserRouter> | ||
<Router /> | ||
</BrowserRouter> | ||
</ChakraProvider> | ||
) | ||
); |
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,5 @@ | ||
import { Box, Center, Stack } from "@chakra-ui/react"; | ||
import { motion } from "framer-motion"; | ||
export const MotionBox = motion(Box); | ||
export const MotionCenter = motion(Center); | ||
export const MotionStack = motion(Stack); |
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,40 @@ | ||
import { AnimatePresence } from "framer-motion"; | ||
import { MotionBox } from "./AnimationComponents"; | ||
|
||
export const FadeToggle = ({ showFirst, first, second }: any) => { | ||
return ( | ||
<AnimatePresence> | ||
{showFirst && ( | ||
<MotionBox | ||
position="absolute" | ||
overflow="hidden" | ||
key="1" | ||
initial={{ | ||
opacity: 0, | ||
}} | ||
animate={{ | ||
opacity: 1, | ||
transition: { duration: 0.5, ease: "easeIn" }, | ||
}} | ||
exit={{ opacity: 0 }} | ||
> | ||
{first} | ||
</MotionBox> | ||
)} | ||
{!showFirst && ( | ||
<MotionBox | ||
position="absolute" | ||
key="2" | ||
initial={{ opacity: 0 }} | ||
animate={{ | ||
opacity: 1, | ||
transition: { duration: 0.5, ease: "easeIn" }, | ||
}} | ||
exit={{ opacity: 0 }} | ||
> | ||
{second} | ||
</MotionBox> | ||
)} | ||
</AnimatePresence> | ||
); | ||
}; |
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,80 @@ | ||
import { Box, Button, Stack, Text } from "@chakra-ui/react"; | ||
import { | ||
animate, | ||
motion, | ||
MotionValue, | ||
useMotionValue, | ||
useTransform, | ||
transform, | ||
} from "framer-motion"; | ||
import { useState } from "react"; | ||
import { MotionBox } from "../../Components/Animation/AnimationComponents"; | ||
import { snap } from "popmotion"; | ||
export const ListPage = () => { | ||
const elements = [ | ||
{ | ||
subtitle: "Do it yourself", | ||
title: "Making a Minjito", | ||
}, | ||
{ | ||
subtitle: "Step 1", | ||
title: "Add some ice cubes", | ||
}, | ||
{ | ||
subtitle: "Step 2", | ||
title: "Add 200ml of Rio cocktail", | ||
}, | ||
{ | ||
subtitle: "Step 3", | ||
title: "Add a pinch of pink salt", | ||
}, | ||
{ | ||
subtitle: "Step 4", | ||
title: "Add 100ml of soda", | ||
}, | ||
{ | ||
subtitle: "Final step", | ||
title: "Garnish with lemon & rosemary", | ||
}, | ||
]; | ||
|
||
const [activeIndex, setActiveIndex] = useState(0); | ||
const handleNext = () => { | ||
const newActiveIndex = activeIndex + 1; | ||
setActiveIndex(newActiveIndex); | ||
}; | ||
|
||
const handlePrev = () => { | ||
const newActiveIndex = activeIndex - 1; | ||
setActiveIndex(newActiveIndex); | ||
}; | ||
|
||
return ( | ||
<Box> | ||
<Box position="relative" w="300px" h="270px" overflow="hidden"> | ||
{elements.map((element) => { | ||
return ( | ||
<MotionBox key={element.title} mb={8}> | ||
<Text fontFamily="Inter Tight" fontSize="50px"> | ||
{element.title} | ||
</Text> | ||
</MotionBox> | ||
); | ||
})} | ||
|
||
<Box | ||
bottom="23px" | ||
left="0" | ||
w="full" | ||
h="119px" | ||
position="absolute" | ||
bg="linear-gradient(0deg, rgb(255 255 255) 0%, rgba(255,255,255,0) 100%)" | ||
></Box> | ||
</Box> | ||
<Stack direction="row" mt={10}> | ||
<Button onClick={handlePrev}> Prev </Button> | ||
<Button onClick={handleNext}> Next </Button> | ||
</Stack> | ||
</Box> | ||
); | ||
}; |
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,14 @@ | ||
import React from "react"; | ||
import ReactPlayer from "react-player"; | ||
|
||
export const VideoDetail = () => { | ||
return ( | ||
<ReactPlayer | ||
playing | ||
loop | ||
url="lights.mp4" | ||
width="100vw" | ||
height="100vh" | ||
></ReactPlayer> | ||
); | ||
}; |
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,36 @@ | ||
import { Box, Button, Img } from "@chakra-ui/react"; | ||
import React, { useState } from "react"; | ||
import { MotionBox } from "../../Components/Animation/AnimationComponents"; | ||
import { ChatIcon, PhoneIcon } from "@chakra-ui/icons"; | ||
import { FadeToggle } from "../../Components/Animation/FadeToggle"; | ||
export const VideoHome = () => { | ||
const [isPhone, setIsPhone] = useState(false); | ||
console.log(isPhone); | ||
|
||
return ( | ||
<Box> | ||
<MotionBox | ||
overflow="hidden" | ||
initial={{ | ||
width: 500, | ||
height: 500, | ||
}} | ||
animate={{ | ||
clipPath: "polygon(50% 0%, 0% 100%, 100% 100%)", | ||
}} | ||
transition={{ duration: 3 }} | ||
> | ||
<Img src="/lights.avif" /> | ||
</MotionBox> | ||
|
||
<Button onClick={() => setIsPhone((prev) => !prev)}>Click</Button> | ||
<Box p={20} overflow="hidden"> | ||
<FadeToggle | ||
showFirst={isPhone} | ||
first={<PhoneIcon fontSize="5xl" />} | ||
second={<ChatIcon fontSize="5xl" />} | ||
/> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
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,18 @@ | ||
import { Route, Routes } from "react-router-dom"; | ||
import { ListPage } from "./Pages/List1/ListPage"; | ||
import { VideoDetail } from "./Pages/Video/VideoDetail"; | ||
import { VideoHome } from "./Pages/Video/VideoHome"; | ||
|
||
const Router = () => { | ||
return ( | ||
<main> | ||
<Routes> | ||
<Route path={"/"} element={<VideoHome />} /> | ||
<Route path={"/list"} element={<ListPage />} /> | ||
<Route path={"/page"} element={<VideoDetail />} /> | ||
</Routes> | ||
</main> | ||
); | ||
}; | ||
|
||
export default Router; |
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
Oops, something went wrong.