skip to Main Content

when in pc screen it shows full width but when switch to mobile it is not full width looks like it’s width is 80-90% also my constent is overflowing outside so it is not so responsive on mobile whyy [enter image description here]

(https://i.sstatic.net/82Gf6xDT.png)

import React, { useState } from 'react';

import { Link } from 'react-router-dom';

import { TiThMenuOutline } from 'react-icons/ti';

import { GiCrossMark } from 'react-icons/gi';

export default function Navbar() {
    const [isOpen, setIsOpen] = useState(false);

    const [rotating, setRotating] = useState(false);

    const [show, setShow] = useState(false);

    const toggleMenu = () => {
        setIsOpen(!isOpen);
    };

    const toggleMain = () => {
        setRotating(true);
        setShow(!show);
        setTimeout(() => {
            setRotating(false);
        }, 500); // This should match the duration of the rotate animation
    };

    return (
        <div className="bg-custom-gradient flex justify-center">
            <nav className=" bg-gradient-to-r from-[#1f353f] via-[#79a8b2] to-[#094c57] shadow-lg border-2 border-white rounded-3xl fixed p-4 w-full font-dongle text-2xl">
                <div className="container mx-auto flex justify-between items-center">
                    <div className="text-white text-4xl font-semibold">
                        Portfolio
                    </div>
                    <div className="relative">
                        <div className="flex items-center justify-between w-full">
                            <div className="overflow-hidden w-full">
                                <div
                                    className={`${
                                        show
                                            ? 'hidden md:flex gap-4 ease-in duration-500'
                                            : 'flex gap-4 mt-[-30px] md:mt-[-30px] ease-in duration-700'
                                    }`}
                                >
                                    <Link
                                        to="/"
                                        className="text-white hover:text-white"
                                    >
                                        Home
                                    </Link>
                                    <Link
                                        to="/about"
                                        className="text-white hover:text-white"
                                    >
                                        About
                                    </Link>
                                    <Link
                                        to="/services"
                                        className="text-white hover:text-white"
                                    >
                                        Services
                                    </Link>
                                    <Link
                                        to="/projects"
                                        className="text-white hover:text-white"
                                    >
                                        Projects
                                    </Link>
                                    <Link
                                        to="/contact"
                                        className="text-white hover:text-white"
                                    >
                                        Contact
                                    </Link>
                                </div>
                            </div>
                            <div>
                                <div className="hidden md:flex ml-4 justify-end">
                                    {show ? (
                                        <button
                                            className={`text-white hover:text-white ${
                                                rotating ? 'animate-rotate' : ''
                                            }`}
                                            onClick={toggleMain}
                                        >
                                            <GiCrossMark />
                                        </button>
                                    ) : (
                                        <button
                                            className={`text-white hover:text-white ${
                                                rotating ? 'animate-rotate' : ''
                                            }`}
                                            onClick={toggleMain}
                                        >
                                            <TiThMenuOutline />
                                        </button>
                                    )}
                                </div>
                            </div>
                        </div>
                    </div>
                    <div className="md:hidden overflow-visible ">
                        <button
                            onClick={toggleMenu}
                            className="text-black focus:outline-none focus:text-black ml-[-90px] overflow-visible "
                        >
                            <TiThMenuOutline />
                        </button>
                    </div>
                </div>
                {isOpen && (
                    <div className="md:hidden mt-2 space-y-2">
                        <Link
                            to="/"
                            className="block text-gray-300 hover:text-white"
                        >
                            Home
                        </Link>
                        <Link
                            to="/about"
                            className="block text-gray-300 hover:text-white"
                        >
                            About
                        </Link>
                        <Link
                            to="/services"
                            className="block text-gray-300 hover:text-white"
                        >
                            Services
                        </Link>
                        <Link
                            to="/projects"
                            className="block text-gray-300 hover:text-white"
                        >
                            Projects
                        </Link>
                        <Link
                            to="/contact"
                            className="block text-gray-300 hover:text-white"
                        >
                            Contact
                        </Link>
                    </div>
                )}
            </nav>
        </div>
    );
}
import React from 'react';

import Navbar from '../comps/Navbar';

import Footer from '../comps/Footer';

export default function Home() {
    return (
        <div className="bg-custom-gradient min-h-screen flex flex-col font-dongle text-4xl w-full">
            {' '}
            <Navbar />
            <div className="flex-grow mt-32">hello</div>
            <Footer />
        </div>
    );
}
// Footer.js

import React from 'react';

import { Link } from 'react-router-dom';

export default function Footer() {
    return (
        <footer className="bg-gray-800 text-gray-300 py-4">
            <div className="container mx-auto text-center">
                <div className="mb-2">
                    <Link
                        to="/"
                        className="text-gray-300 hover:text-white mx-2"
                    >
                        Home
                    </Link>

                    <Link
                        to="/about"
                        className="text-gray-300 hover:text-white mx-2"
                    >
                        About
                    </Link>

                    <Link
                        to="/services"
                        className="text-gray-300 hover:text-white mx-2"
                    >
                        Services
                    </Link>

                    <Link
                        to="/projects"
                        className="text-gray-300 hover:text-white mx-2"
                    >
                        Projects
                    </Link>

                    <Link
                        to="/contact"
                        className="text-gray-300 hover:text-white mx-2"
                    >
                        Contact
                    </Link>
                </div>

                <div className="text-sm">
                    © {new Date().getFullYear()} Portfolio By Mukund. All rights
                    reserved.
                </div>
            </div>
        </footer>
    );
}

i want my code responsive on mobile also although i use tailwind and i make it mobile responsive i can not got good view on mobile

3

Answers


  1. You need to add flex-wrap.

    You are using flex for those footer menu items but on mobile there’s not enough space, so they are "breaking" out. By adding flex-wrap to the parent element, those items will wrap when necessary.

    Login or Signup to reply.
  2. I edited your code a bit. Still far from optimal but works slightly better.

    https://codesandbox.io/p/devbox/angry-yonath-4jwhq3

    Lost some of your colors and transitions but just to show the workings.

    Login or Signup to reply.
  3. The white stripe is caused by horizontal overflow on the right edge of the page. This is caused by your footer navigation. This is because React renders elements without any white space between them, so all the <Link> renders like:

    <a>Home</a><a>About</a><a>Services</a>…
    

    And since <a> elements are display: inline by default, the browser sees this as one long word like:

    HomeAboutServices…
    

    Causing it to overflow the right side.

    Instead, you could consider adding manual spaces between each <Link> like:

    <Link …>Home</Link>
    {" "}
    <Link …>About</Link>
    {" "}
    <Link …>Services</Link>
    …
    
    const { useState } = React;
    const Link = ({ ...props, children }) => <a {...props}>{children}</a>;
    
    /*** `react-icons` code START **/
    const DefaultContext = {
      color: undefined,
      size: undefined,
      className: undefined,
      style: undefined,
      attr: undefined,
    };
    const iconContext_1 = {
      IconContext: React.createContext && React.createContext(DefaultContext),
    };
    var __assign =
      (this && this.__assign) ||
      function () {
        __assign =
          Object.assign ||
          function (t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s)
                if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
            return t;
          };
        return __assign.apply(this, arguments);
      };
    var __rest =
      (this && this.__rest) ||
      function (s, e) {
        var t = {};
        for (var p in s)
          if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (
              e.indexOf(p[i]) < 0 &&
              Object.prototype.propertyIsEnumerable.call(s, p[i])
            )
              t[p[i]] = s[p[i]];
          }
        return t;
      };
    function IconBase(props) {
      var elem = function (conf) {
        var attr = props.attr,
          size = props.size,
          title = props.title,
          svgProps = __rest(props, ["attr", "size", "title"]);
        var computedSize = size || conf.size || "1em";
        var className;
        if (conf.className) className = conf.className;
        if (props.className)
          className = (className ? className + " " : "") + props.className;
        return React.createElement(
          "svg",
          __assign(
            { stroke: "currentColor", fill: "currentColor", strokeWidth: "0" },
            conf.attr,
            attr,
            svgProps,
            {
              className: className,
              style: __assign(
                __assign({ color: props.color || conf.color }, conf.style),
                props.style,
              ),
              height: computedSize,
              width: computedSize,
              xmlns: "http://www.w3.org/2000/svg",
            },
          ),
          title && React.createElement("title", null, title),
          props.children,
        );
      };
      return iconContext_1.IconContext !== undefined
        ? React.createElement(
            iconContext_1.IconContext.Consumer,
            null,
            function (conf) {
              return elem(conf);
            },
          )
        : elem(iconContext_1.DefaultContext);
    }
    
    function Tree2Element(tree) {
      return (
        tree &&
        tree.map(function (node, i) {
          return React.createElement(
            node.tag,
            __assign({ key: i }, node.attr),
            Tree2Element(node.child),
          );
        })
      );
    }
    function GenIcon(data) {
      return function (props) {
        return React.createElement(
          IconBase,
          __assign({ attr: __assign({}, data.attr) }, props),
          Tree2Element(data.child),
        );
      };
    }
    
    function TiThMenuOutline(props) {
      return GenIcon({
        tag: "svg",
        attr: { version: "1.2", baseProfile: "tiny", viewBox: "0 0 24 24" },
        child: [
          {
            tag: "path",
            attr: {
              d: "M19 18c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3zM19 11c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3zM19 4c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3z",
            },
            child: [],
          },
        ],
      })(props);
    }
    
    function GiCrossMark(props) {
      return GenIcon({
        tag: "svg",
        attr: { viewBox: "0 0 512 512" },
        child: [
          {
            tag: "path",
            attr: {
              d: "M105.367 18.328c23.14 15.444 46.098 31.27 68.55 47.572-45.055-20.895-94.51-35.918-149.37-44.246 46.697 26.72 91.596 55.58 135.705 85.524-37.203-18.033-77.48-32.22-121.602-41.37 58.218 34.322 109.368 72.465 154.71 114.206C136.02 227.227 86.295 284.717 45.79 354.18c27.11-24.29 54.91-47.545 82.868-70.68C81.942 339.36 45.05 405.01 20.2 482.135c20.36-24.62 40.988-48.203 61.905-70.817 44.7-67.485 89.567-147.11 148.856-170.418-29.61 30.708-63.36 75.164-98.25 118.145 40.99-40.437 83.09-77.46 126.415-111.512 61.598 70.49 110.757 149.38 152.145 235.873-6.738-44.794-16.796-87.384-30.03-127.666l46.444 65.53s-26.037-72.69-43.66-101.987c40.76 55.91 78.208 114.428 112.328 175.205-18.674-89.454-50.512-169.772-98.893-238.224 34.906 34.69 68.637 71.1 100.93 109.045C465.048 288.827 423.58 221.82 372.214 167c40.224-25.887 81.48-49.73 123.863-71.783-32.025 5.56-62.49 12.92-92.006 21.934 21.836-16.173 44.41-32.124 67.024-47.523-37.987 11.91-74.633 25.775-109.067 41.433 42.668-27.673 86.32-53.668 131.004-78.602h-.003c-67.47 18.055-130.83 42.19-188.998 73.548-56.294-41.79-122.01-71.787-198.663-87.68z",
            },
            child: [],
          },
        ],
      })(props);
    }
    /*** `react-icons` code END **/
    
    function Navbar() {
      const [isOpen, setIsOpen] = useState(false);
    
      const [rotating, setRotating] = useState(false);
    
      const [show, setShow] = useState(false);
    
      const toggleMenu = () => {
        setIsOpen(!isOpen);
      };
    
      const toggleMain = () => {
        setRotating(true);
        setShow(!show);
        setTimeout(() => {
          setRotating(false);
        }, 500); // This should match the duration of the rotate animation
      };
    
      return (
        <div className="bg-custom-gradient flex justify-center">
          <nav className=" bg-gradient-to-r from-[#1f353f] via-[#79a8b2] to-[#094c57] shadow-lg border-2 border-white rounded-3xl fixed p-4 w-full font-dongle text-2xl">
            <div className="container mx-auto flex justify-between items-center">
              <div className="text-white text-4xl font-semibold">Portfolio</div>
              <div className="relative">
                <div className="flex items-center justify-between w-full">
                  <div className="overflow-hidden w-full">
                    <div
                      className={`${
                        show
                          ? "hidden md:flex gap-4 ease-in duration-500"
                          : "flex gap-4 mt-[-30px] md:mt-[-30px] ease-in duration-700"
                      }`}
                    >
                      <Link to="/" className="text-white hover:text-white">
                        Home
                      </Link>
                      <Link to="/about" className="text-white hover:text-white">
                        About
                      </Link>
                      <Link to="/services" className="text-white hover:text-white">
                        Services
                      </Link>
                      <Link to="/projects" className="text-white hover:text-white">
                        Projects
                      </Link>
                      <Link to="/contact" className="text-white hover:text-white">
                        Contact
                      </Link>
                    </div>
                  </div>
                  <div>
                    <div className="hidden md:flex ml-4 justify-end">
                      {show ? (
                        <button
                          className={`text-white hover:text-white ${
                            rotating ? "animate-rotate" : ""
                          }`}
                          onClick={toggleMain}
                        >
                          <GiCrossMark />
                        </button>
                      ) : (
                        <button
                          className={`text-white hover:text-white ${
                            rotating ? "animate-rotate" : ""
                          }`}
                          onClick={toggleMain}
                        >
                          <TiThMenuOutline />
                        </button>
                      )}
                    </div>
                  </div>
                </div>
              </div>
              <div className="md:hidden overflow-visible ">
                <button
                  onClick={toggleMenu}
                  className="text-black focus:outline-none focus:text-black ml-[-90px] overflow-visible "
                >
                  <TiThMenuOutline />
                </button>
              </div>
            </div>
            {isOpen && (
              <div className="md:hidden mt-2 space-y-2">
                <Link to="/" className="block text-gray-300 hover:text-white">
                  Home
                </Link>
                <Link to="/about" className="block text-gray-300 hover:text-white">
                  About
                </Link>
                <Link
                  to="/services"
                  className="block text-gray-300 hover:text-white"
                >
                  Services
                </Link>
                <Link
                  to="/projects"
                  className="block text-gray-300 hover:text-white"
                >
                  Projects
                </Link>
                <Link
                  to="/contact"
                  className="block text-gray-300 hover:text-white"
                >
                  Contact
                </Link>
              </div>
            )}
          </nav>
        </div>
      );
    }
    
    function Footer() {
      return (
        <footer className="bg-gray-800 text-gray-300 py-4">
          <div className="container mx-auto text-center">
            <div className="mb-2">
              <Link to="/" className="text-gray-300 hover:text-white mx-2">
                Home
              </Link>{" "}
              <Link to="/about" className="text-gray-300 hover:text-white mx-2">
                About
              </Link>{" "}
              <Link to="/services" className="text-gray-300 hover:text-white mx-2">
                Services
              </Link>{" "}
              <Link to="/projects" className="text-gray-300 hover:text-white mx-2">
                Projects
              </Link>{" "}
              <Link to="/contact" className="text-gray-300 hover:text-white mx-2">
                Contact
              </Link>
            </div>
    
            <div className="text-sm">
              © {new Date().getFullYear()} Portfolio By Mukund. All rights
              reserved.
            </div>
          </div>
        </footer>
      );
    }
    
    function Home() {
      return (
        <div className="bg-custom-gradient min-h-screen flex flex-col font-dongle text-4xl w-full">
          {" "}
          <Navbar />
          <div className="flex-grow mt-32">hello</div>
          <Footer />
        </div>
      );
    }
    
    ReactDOM.createRoot(document.getElementById("app")).render(<Home />);
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.production.min.js" integrity="sha512-QVs8Lo43F9lSuBykadDb0oSXDL/BbZ588urWVCRwSIoewQv/Ewg1f84mK3U790bZ0FfhFa1YSQUmIhG+pIRKeg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.production.min.js" integrity="sha512-6a1107rTlA4gYpgHAqbwLAtxmWipBdJFcq8y5S/aTge3Bp+VAklABm2LO+Kg51vOWR9JMZq1Ovjl5tpluNpTeQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdn.tailwindcss.com/3.4.4"></script>
    
    <div id="app"></div>

    Alternatively, you could consider using a horizontal flex layout with wrapping. This may behave more predictably for you. You can also use gap-* instead of mx-* on each of the children:

    <div className="mb-2 flex flex-wrap gap-4"
      <Link …>Home</Link>
      <Link …>About</Link>
      <Link …>Services</Link>
    …
    
    const { useState } = React;
    const Link = ({ ...props, children }) => <a {...props}>{children}</a>;
    
    /*** `react-icons` code START **/
    const DefaultContext = {
      color: undefined,
      size: undefined,
      className: undefined,
      style: undefined,
      attr: undefined,
    };
    const iconContext_1 = {
      IconContext: React.createContext && React.createContext(DefaultContext),
    };
    var __assign =
      (this && this.__assign) ||
      function () {
        __assign =
          Object.assign ||
          function (t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s)
                if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
            return t;
          };
        return __assign.apply(this, arguments);
      };
    var __rest =
      (this && this.__rest) ||
      function (s, e) {
        var t = {};
        for (var p in s)
          if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (
              e.indexOf(p[i]) < 0 &&
              Object.prototype.propertyIsEnumerable.call(s, p[i])
            )
              t[p[i]] = s[p[i]];
          }
        return t;
      };
    function IconBase(props) {
      var elem = function (conf) {
        var attr = props.attr,
          size = props.size,
          title = props.title,
          svgProps = __rest(props, ["attr", "size", "title"]);
        var computedSize = size || conf.size || "1em";
        var className;
        if (conf.className) className = conf.className;
        if (props.className)
          className = (className ? className + " " : "") + props.className;
        return React.createElement(
          "svg",
          __assign(
            { stroke: "currentColor", fill: "currentColor", strokeWidth: "0" },
            conf.attr,
            attr,
            svgProps,
            {
              className: className,
              style: __assign(
                __assign({ color: props.color || conf.color }, conf.style),
                props.style,
              ),
              height: computedSize,
              width: computedSize,
              xmlns: "http://www.w3.org/2000/svg",
            },
          ),
          title && React.createElement("title", null, title),
          props.children,
        );
      };
      return iconContext_1.IconContext !== undefined
        ? React.createElement(
            iconContext_1.IconContext.Consumer,
            null,
            function (conf) {
              return elem(conf);
            },
          )
        : elem(iconContext_1.DefaultContext);
    }
    
    function Tree2Element(tree) {
      return (
        tree &&
        tree.map(function (node, i) {
          return React.createElement(
            node.tag,
            __assign({ key: i }, node.attr),
            Tree2Element(node.child),
          );
        })
      );
    }
    function GenIcon(data) {
      return function (props) {
        return React.createElement(
          IconBase,
          __assign({ attr: __assign({}, data.attr) }, props),
          Tree2Element(data.child),
        );
      };
    }
    
    function TiThMenuOutline(props) {
      return GenIcon({
        tag: "svg",
        attr: { version: "1.2", baseProfile: "tiny", viewBox: "0 0 24 24" },
        child: [
          {
            tag: "path",
            attr: {
              d: "M19 18c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3zM19 11c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3zM19 4c.55 0 1 .45 1 1s-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14m0-2h-14c-1.654 0-3 1.346-3 3s1.346 3 3 3h14c1.654 0 3-1.346 3-3s-1.346-3-3-3z",
            },
            child: [],
          },
        ],
      })(props);
    }
    
    function GiCrossMark(props) {
      return GenIcon({
        tag: "svg",
        attr: { viewBox: "0 0 512 512" },
        child: [
          {
            tag: "path",
            attr: {
              d: "M105.367 18.328c23.14 15.444 46.098 31.27 68.55 47.572-45.055-20.895-94.51-35.918-149.37-44.246 46.697 26.72 91.596 55.58 135.705 85.524-37.203-18.033-77.48-32.22-121.602-41.37 58.218 34.322 109.368 72.465 154.71 114.206C136.02 227.227 86.295 284.717 45.79 354.18c27.11-24.29 54.91-47.545 82.868-70.68C81.942 339.36 45.05 405.01 20.2 482.135c20.36-24.62 40.988-48.203 61.905-70.817 44.7-67.485 89.567-147.11 148.856-170.418-29.61 30.708-63.36 75.164-98.25 118.145 40.99-40.437 83.09-77.46 126.415-111.512 61.598 70.49 110.757 149.38 152.145 235.873-6.738-44.794-16.796-87.384-30.03-127.666l46.444 65.53s-26.037-72.69-43.66-101.987c40.76 55.91 78.208 114.428 112.328 175.205-18.674-89.454-50.512-169.772-98.893-238.224 34.906 34.69 68.637 71.1 100.93 109.045C465.048 288.827 423.58 221.82 372.214 167c40.224-25.887 81.48-49.73 123.863-71.783-32.025 5.56-62.49 12.92-92.006 21.934 21.836-16.173 44.41-32.124 67.024-47.523-37.987 11.91-74.633 25.775-109.067 41.433 42.668-27.673 86.32-53.668 131.004-78.602h-.003c-67.47 18.055-130.83 42.19-188.998 73.548-56.294-41.79-122.01-71.787-198.663-87.68z",
            },
            child: [],
          },
        ],
      })(props);
    }
    /*** `react-icons` code END **/
    
    function Navbar() {
      const [isOpen, setIsOpen] = useState(false);
    
      const [rotating, setRotating] = useState(false);
    
      const [show, setShow] = useState(false);
    
      const toggleMenu = () => {
        setIsOpen(!isOpen);
      };
    
      const toggleMain = () => {
        setRotating(true);
        setShow(!show);
        setTimeout(() => {
          setRotating(false);
        }, 500); // This should match the duration of the rotate animation
      };
    
      return (
        <div className="bg-custom-gradient flex justify-center">
          <nav className=" bg-gradient-to-r from-[#1f353f] via-[#79a8b2] to-[#094c57] shadow-lg border-2 border-white rounded-3xl fixed p-4 w-full font-dongle text-2xl">
            <div className="container mx-auto flex justify-between items-center">
              <div className="text-white text-4xl font-semibold">Portfolio</div>
              <div className="relative">
                <div className="flex items-center justify-between w-full">
                  <div className="overflow-hidden w-full">
                    <div
                      className={`${
                        show
                          ? "hidden md:flex gap-4 ease-in duration-500"
                          : "flex gap-4 mt-[-30px] md:mt-[-30px] ease-in duration-700"
                      }`}
                    >
                      <Link to="/" className="text-white hover:text-white">
                        Home
                      </Link>
                      <Link to="/about" className="text-white hover:text-white">
                        About
                      </Link>
                      <Link to="/services" className="text-white hover:text-white">
                        Services
                      </Link>
                      <Link to="/projects" className="text-white hover:text-white">
                        Projects
                      </Link>
                      <Link to="/contact" className="text-white hover:text-white">
                        Contact
                      </Link>
                    </div>
                  </div>
                  <div>
                    <div className="hidden md:flex ml-4 justify-end">
                      {show ? (
                        <button
                          className={`text-white hover:text-white ${
                            rotating ? "animate-rotate" : ""
                          }`}
                          onClick={toggleMain}
                        >
                          <GiCrossMark />
                        </button>
                      ) : (
                        <button
                          className={`text-white hover:text-white ${
                            rotating ? "animate-rotate" : ""
                          }`}
                          onClick={toggleMain}
                        >
                          <TiThMenuOutline />
                        </button>
                      )}
                    </div>
                  </div>
                </div>
              </div>
              <div className="md:hidden overflow-visible ">
                <button
                  onClick={toggleMenu}
                  className="text-black focus:outline-none focus:text-black ml-[-90px] overflow-visible "
                >
                  <TiThMenuOutline />
                </button>
              </div>
            </div>
            {isOpen && (
              <div className="md:hidden mt-2 space-y-2">
                <Link to="/" className="block text-gray-300 hover:text-white">
                  Home
                </Link>
                <Link to="/about" className="block text-gray-300 hover:text-white">
                  About
                </Link>
                <Link
                  to="/services"
                  className="block text-gray-300 hover:text-white"
                >
                  Services
                </Link>
                <Link
                  to="/projects"
                  className="block text-gray-300 hover:text-white"
                >
                  Projects
                </Link>
                <Link
                  to="/contact"
                  className="block text-gray-300 hover:text-white"
                >
                  Contact
                </Link>
              </div>
            )}
          </nav>
        </div>
      );
    }
    
    function Footer() {
      return (
        <footer className="bg-gray-800 text-gray-300 py-4">
          <div className="container mx-auto text-center">
            <div className="mb-2 flex flex-wrap gap-4">
              <Link to="/" className="text-gray-300 hover:text-white">
                Home
              </Link>
              <Link to="/about" className="text-gray-300 hover:text-white">
                About
              </Link>
              <Link to="/services" className="text-gray-300 hover:text-white2">
                Services
              </Link>
              <Link to="/projects" className="text-gray-300 hover:text-white">
                Projects
              </Link>
              <Link to="/contact" className="text-gray-300 hover:text-white">
                Contact
              </Link>
            </div>
    
            <div className="text-sm">
              © {new Date().getFullYear()} Portfolio By Mukund. All rights
              reserved.
            </div>
          </div>
        </footer>
      );
    }
    
    function Home() {
      return (
        <div className="bg-custom-gradient min-h-screen flex flex-col font-dongle text-4xl w-full">
          {" "}
          <Navbar />
          <div className="flex-grow mt-32">hello</div>
          <Footer />
        </div>
      );
    }
    
    ReactDOM.createRoot(document.getElementById("app")).render(<Home />);
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.production.min.js" integrity="sha512-QVs8Lo43F9lSuBykadDb0oSXDL/BbZ588urWVCRwSIoewQv/Ewg1f84mK3U790bZ0FfhFa1YSQUmIhG+pIRKeg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.production.min.js" integrity="sha512-6a1107rTlA4gYpgHAqbwLAtxmWipBdJFcq8y5S/aTge3Bp+VAklABm2LO+Kg51vOWR9JMZq1Ovjl5tpluNpTeQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdn.tailwindcss.com/3.4.4"></script>
    
    <div id="app"></div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search