From bb8be6cac901edd6d1ca1882b5369492773087ba Mon Sep 17 00:00:00 2001 From: Yana Date: Thu, 24 Oct 2024 13:16:44 +0300 Subject: [PATCH] Fix responsive design --- .../docs/components/landing-page.tsx | 69 +++++-------------- 1 file changed, 17 insertions(+), 52 deletions(-) diff --git a/documentation/docs/components/landing-page.tsx b/documentation/docs/components/landing-page.tsx index 2c75380d6c..3059743c5e 100644 --- a/documentation/docs/components/landing-page.tsx +++ b/documentation/docs/components/landing-page.tsx @@ -1,5 +1,8 @@ import React from "react"; import { Box, Grid, Typography } from "@mui/material"; +import useMediaQuery from "@mui/material/useMediaQuery"; +import { useTheme } from "@mui/material/styles"; + import Image from "next/image"; import Link from "next/link"; @@ -7,8 +10,13 @@ import networkDocs from "./images/network-docs.png"; import developerDocs from "./images/developer-docs.png"; import sdkDocs from "./images/sdk-docs.png"; import operatorGuide from "./images/operator-guide.png"; +import { t } from "nextra/dist/types-c8e621b7"; export const LandingPage = () => { + const theme = useTheme(); + const isTablet = useMediaQuery(theme.breakpoints.up("md")); + const isDesktop = useMediaQuery(theme.breakpoints.up("xl")); + const squares = [ { text: "Network Docs", @@ -41,6 +49,10 @@ export const LandingPage = () => { }, ]; + const shortenDescription = (description: string) => { + return description.slice(0, 18) + "..."; + }; + return ( @@ -60,7 +72,7 @@ export const LandingPage = () => { item key={index} xs={12} - md={6} + lg={6} padding={4} width={"100%"} sx={{ @@ -92,8 +104,11 @@ export const LandingPage = () => { {square.text} - {square.description} + {isTablet && !isDesktop + ? shortenDescription(square.description) + : square.description} + Open @@ -103,56 +118,6 @@ export const LandingPage = () => { ))} - - ); };