-
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.
Merge pull request #134 from MurakawaTakuya/feat/top-page-introduction
トップページ/紹介ページ作成
- Loading branch information
Showing
45 changed files
with
744 additions
and
160 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 { AnimationConfigs, AnimationType } from "@/types/types"; | ||
import { FC, ReactNode } from "react"; | ||
import BottomIn from "./BottomIn"; | ||
import CenterIn from "./CenterIn"; | ||
import LeftIn from "./LeftIn"; | ||
import RightIn from "./RightIn"; | ||
import TopIn from "./TopIn"; | ||
|
||
interface AnimationProps { | ||
animationType?: AnimationType; | ||
children: ReactNode; | ||
} | ||
|
||
export default function Animation({ | ||
animationType = "center", | ||
children, | ||
...configs | ||
}: AnimationProps & AnimationConfigs) { | ||
const animationComponents: Record<AnimationType, FC<AnimationConfigs>> = { | ||
left: LeftIn, | ||
right: RightIn, | ||
top: TopIn, | ||
bottom: BottomIn, | ||
center: CenterIn, | ||
}; | ||
|
||
const AnimationComponent = animationComponents[animationType] || CenterIn; | ||
return <AnimationComponent {...configs}>{children}</AnimationComponent>; | ||
} |
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,30 @@ | ||
"use client"; | ||
import { AnimationConfigs } from "@/types/types"; | ||
import { motion, useInView } from "framer-motion"; | ||
import { useRef } from "react"; | ||
|
||
// 下からフェードイン | ||
export default function BottomIn({ | ||
children, | ||
duration = 0.7, | ||
delay = 0, | ||
distance = 40, | ||
margin = 50, | ||
}: AnimationConfigs) { | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
const isInView = useInView(ref, { | ||
once: true, | ||
margin: `${-margin}px`, // 画面に入ってからmargin分超えたら表示 | ||
}); | ||
|
||
return ( | ||
<motion.div | ||
ref={ref} | ||
initial={{ opacity: 0, y: distance }} | ||
animate={{ opacity: isInView ? 1 : 0, y: isInView ? 0 : distance }} | ||
transition={{ duration, ease: "easeOut", delay }} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
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 @@ | ||
"use client"; | ||
import { AnimationConfigs } from "@/types/types"; | ||
import { motion, useInView } from "framer-motion"; | ||
import { useRef } from "react"; | ||
|
||
// その場でフェードイン | ||
export default function CenterIn({ | ||
children, | ||
duration = 0.6, | ||
delay = 0, | ||
margin = 50, | ||
}: AnimationConfigs) { | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
const isInView = useInView(ref, { | ||
once: true, | ||
margin: `${-margin}px`, // 画面に入ってからmargin分超えたら表示 | ||
}); | ||
|
||
return ( | ||
<motion.div | ||
ref={ref} | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: isInView ? 1 : 0 }} | ||
transition={{ duration, ease: "easeOut", delay }} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
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,30 @@ | ||
"use client"; | ||
import { AnimationConfigs } from "@/types/types"; | ||
import { motion, useInView } from "framer-motion"; | ||
import { useRef } from "react"; | ||
|
||
// 左からフェードイン | ||
export default function LeftIn({ | ||
children, | ||
duration = 0.7, | ||
delay = 0, | ||
distance = 60, | ||
margin = 50, | ||
}: AnimationConfigs) { | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
const isInView = useInView(ref, { | ||
once: true, | ||
margin: `${-margin}px`, // 画面に入ってからmargin分超えたら表示 | ||
}); | ||
|
||
return ( | ||
<motion.div | ||
ref={ref} | ||
initial={{ opacity: 0, x: -distance }} | ||
animate={{ opacity: isInView ? 1 : 0, x: isInView ? 0 : -distance }} | ||
transition={{ duration, ease: "easeOut", delay }} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
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,30 @@ | ||
"use client"; | ||
import { AnimationConfigs } from "@/types/types"; | ||
import { motion, useInView } from "framer-motion"; | ||
import { useRef } from "react"; | ||
|
||
// 右からフェードイン | ||
export default function RightIn({ | ||
children, | ||
duration = 0.7, | ||
delay = 0, | ||
distance = 60, | ||
margin = 50, | ||
}: AnimationConfigs) { | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
const isInView = useInView(ref, { | ||
once: true, | ||
margin: `${-margin}px`, // 画面に入ってからmargin分超えたら表示 | ||
}); | ||
|
||
return ( | ||
<motion.div | ||
ref={ref} | ||
initial={{ opacity: 0, x: distance }} | ||
animate={{ opacity: isInView ? 1 : 0, x: isInView ? 0 : distance }} | ||
transition={{ duration, ease: "easeOut", delay }} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
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,30 @@ | ||
"use client"; | ||
import { AnimationConfigs } from "@/types/types"; | ||
import { motion, useInView } from "framer-motion"; | ||
import { useRef } from "react"; | ||
|
||
// 上からフェードイン | ||
export default function TopIn({ | ||
children, | ||
duration = 0.7, | ||
delay = 0, | ||
distance = 40, | ||
margin = 50, | ||
}: AnimationConfigs) { | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
const isInView = useInView(ref, { | ||
once: true, | ||
margin: `${-margin}px`, // 画面に入ってからmargin分超えたら表示 | ||
}); | ||
|
||
return ( | ||
<motion.div | ||
ref={ref} | ||
initial={{ opacity: 0, y: -distance }} | ||
animate={{ opacity: isInView ? 1 : 0, y: isInView ? 0 : -distance }} | ||
transition={{ duration, ease: "easeOut", delay }} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
Oops, something went wrong.