Skip to content

Commit

Permalink
useBigPhoneView
Browse files Browse the repository at this point in the history
  • Loading branch information
roienatan committed Oct 25, 2023
1 parent 75a947a commit dc85068
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { FC } from "react";
import { useTranslation } from "react-i18next";
import landingMobilePosterSec from "@/shared/assets/images/landing-mobile-poster.jpg";
import landingVideoPosterSrc from "@/shared/assets/images/landing-video-poster.jpg";
import landingVideoSrc from "@/shared/assets/videos/landing-video.mp4";
import { useIsPhoneView } from "@/shared/hooks/viewport";
import { useIsBigPhoneView } from "@/shared/hooks/viewport";
import { Button, ButtonVariant } from "@/shared/ui-kit";
import "./index.scss";

Expand All @@ -15,12 +14,12 @@ const VideoSection: FC<VideoSectionProps> = ({ onLaunchClick }) => {
const { t } = useTranslation("translation", {
keyPrefix: "landing",
});
const isPhoneView = useIsPhoneView();
const isBigPhoneView = useIsBigPhoneView();

return (
<section className="landing-video-section">
<div className="landing-video-section__video-wrapper">
{!isPhoneView && (
{!isBigPhoneView && (
<video
className="landing-video-section__video"
autoPlay
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants/viewportBreakpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum ViewportBreakpoint {
Desktop = 1560,
Laptop = 1152,
Tablet = 768,
BigPhone = 450,
Phone = 390,
}

Expand Down
1 change: 1 addition & 0 deletions src/shared/hooks/viewport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from "./useIsLaptopView";
export * from "./useIsPhoneOrientedView";
export * from "./useIsPhoneView";
export * from "./useIsTabletView";
export * from "./useIsBigPhoneView";
5 changes: 5 additions & 0 deletions src/shared/hooks/viewport/useIsBigPhoneView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ViewportBreakpoint } from "@/shared/constants";
import useScreenSize from "../useScreenSize";

export const useIsBigPhoneView = (): boolean =>
useScreenSize(`max-width: ${ViewportBreakpoint.BigPhone}px`);

0 comments on commit dc85068

Please sign in to comment.