add animations

This commit is contained in:
nflnkr 2022-12-24 15:36:05 +03:00
parent b910de9624
commit e00fba297d
4 changed files with 68 additions and 25 deletions

@ -5,7 +5,9 @@ import CustomButton from "./CustomButton";
interface Props { interface Props {
image: string; image?: string;
video?: string;
poster?: string;
headerText: string; headerText: string;
text: string; text: string;
linkHref: string; linkHref: string;
@ -18,6 +20,8 @@ interface Props {
export default function CardWithLink({ export default function CardWithLink({
image, image,
video,
poster,
headerText, headerText,
text, text,
linkHref, linkHref,
@ -63,7 +67,7 @@ export default function CardWithLink({
> >
<Box sx={{ <Box sx={{
alignSelf: "center", alignSelf: "center",
backgroundImage: `url(${image})`, backgroundImage: image ? `url(${image})` : undefined,
width: "100%", width: "100%",
height: "100%", height: "100%",
maxHeight: "196px", maxHeight: "196px",
@ -71,7 +75,27 @@ export default function CardWithLink({
backgroundSize: "contain", backgroundSize: "contain",
backgroundRepeat: "no-repeat", backgroundRepeat: "no-repeat",
backgroundPosition: "center", backgroundPosition: "center",
}} /> display: "flex",
alignItems: "center",
overflow: "hidden",
}}>
{video &&
<video
autoPlay
loop
muted
playsInline
poster={poster}
style={{
width: "100%",
height: "150%",
}}
>
<source src={video} type="video/webm" />
Your browser doesn't support HTML5 video tag.
</video>
}
</Box>
<Typography variant="h5" sx={{ my: "12px" }}>{headerText}</Typography> <Typography variant="h5" sx={{ my: "12px" }}>{headerText}</Typography>
<Typography>{text}</Typography> <Typography>{text}</Typography>
{buttonType === "link" ? {buttonType === "link" ?

@ -1,8 +1,9 @@
import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import pena_illustration02 from "../../assets/pena_illustration02.png";
import CustomButton from "../../components/CustomButton"; import CustomButton from "../../components/CustomButton";
import PenaLogo from "../../components/PenaLogo"; import PenaLogo from "../../components/PenaLogo";
import SectionWrapper from "../../components/SectionWrapper"; import SectionWrapper from "../../components/SectionWrapper";
import mainShapeVideo from "../../assets/animations/main.webm";
import previewMain from "../../assets/animations/preview_main.png";
export default function Section1() { export default function Section1() {
@ -18,8 +19,8 @@ export default function Section1() {
}} }}
sx={{ sx={{
display: "flex", display: "flex",
pt: "70px", pt: upMd ? "70px" : "20px",
pb: upMd ? "40px" : "70px", pb: "70px",
justifyContent: "space-between", justifyContent: "space-between",
flexDirection: upMd ? "row" : "column", flexDirection: upMd ? "row" : "column",
}} }}
@ -43,8 +44,8 @@ export default function Section1() {
textAlign: "center", textAlign: "center",
order: upMd ? 2 : 1, order: upMd ? 2 : 1,
mx: upMd ? "30px" : 0, mx: upMd ? "30px" : 0,
mt: upMd ? undefined : "-70px", // mt: upMd ? undefined : "-70px",
mb: upMd ? undefined : "-30px", // mb: upMd ? undefined : "-30px",
alignSelf: "center", alignSelf: "center",
aspectRatio: "1 / 1", aspectRatio: "1 / 1",
width: upMd ? undefined : "100%", width: upMd ? undefined : "100%",
@ -52,14 +53,21 @@ export default function Section1() {
maxHeight: "301px", maxHeight: "301px",
}} }}
> >
<img <video
autoPlay
loop
muted
playsInline
poster={previewMain}
style={{ style={{
transform: upMd ? undefined : "rotate(-90deg)", width: "100%",
width: upMd ? "100%" : `${170 / 301 * 100}%`, height: "100%",
// transform: upMd ? undefined : "rotate(-90deg)",
}} }}
src={pena_illustration02} >
alt="pena illustration" <source src={mainShapeVideo} type="video/webm" />
/> Your browser doesn't support HTML5 video tag.
</video>
</Box> </Box>
<Box <Box
sx={{ sx={{

@ -1,11 +1,14 @@
import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import CardWithLink from "../../components/CardWithLink"; import CardWithLink from "../../components/CardWithLink";
import pena_illustration01 from "../../assets/pena_illustration01.png";
import pena_illustration03 from "../../assets/pena_illustration03.png";
import pena_illustration04 from "../../assets/pena_illustration04.png";
import UnderlinedLink from "../../components/UnderlinedLink"; import UnderlinedLink from "../../components/UnderlinedLink";
import SectionWrapper from "../../components/SectionWrapper"; import SectionWrapper from "../../components/SectionWrapper";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import icon1 from "../../assets/animations/Icon_1.webm";
import icon2 from "../../assets/animations/Icon_2.webm";
import icon3 from "../../assets/animations/Icon_3.webm";
import preview1 from "../../assets/animations/preview_1.png";
import preview2 from "../../assets/animations/preview_2.png";
import preview3 from "../../assets/animations/preview_3.png";
export default function Section2() { export default function Section2() {
@ -85,7 +88,8 @@ export default function Section2() {
text="Текст- это текст, который имеет некоторые характеристики реального письменного текс" text="Текст- это текст, который имеет некоторые характеристики реального письменного текс"
isHighlighted isHighlighted
linkHref="#" linkHref="#"
image={pena_illustration03} video={icon1}
poster={preview1}
/> />
<CardWithLink <CardWithLink
shadowType="dark" shadowType="dark"
@ -95,7 +99,8 @@ export default function Section2() {
headerText="Опросник" headerText="Опросник"
text="Текст- это текст, который имеет некоторые характеристики реального письменного текс" text="Текст- это текст, который имеет некоторые характеристики реального письменного текс"
linkHref="#" linkHref="#"
image={pena_illustration04} video={icon2}
poster={preview2}
/> />
<CardWithLink <CardWithLink
shadowType="dark" shadowType="dark"
@ -105,7 +110,8 @@ export default function Section2() {
headerText="Сокращатель ссылок" headerText="Сокращатель ссылок"
text="Текст- это текст, который имеет некоторые характеристики реального письменного текс" text="Текст- это текст, который имеет некоторые характеристики реального письменного текс"
linkHref="#" linkHref="#"
image={pena_illustration01} video={icon3}
poster={preview3}
/> />
</Box> </Box>
</SectionWrapper> </SectionWrapper>

@ -1 +1,6 @@
/// <reference types="react-scripts" /> /// <reference types="react-scripts" />
declare module "*.webm" {
const src: string;
export default src;
}