Back to Courses

World's Best MERN Stack Course

#25: Building a Complete MERN Stack Website | 404 Error Page, Styling, and More!

Welcome, we will be Building a Complete MERN Stack Website! Learn to craft a complete website by addressing key elements such as creating a 404 error page, styling components, and enhancing the overall user experience. πŸ“š Resources mentioned in our MERN Course & Don't forget to watch πŸ‘‡

πŸ‘‰ JavaScript Course: https://youtu.be/KGkiIBTq0y0?si=HLXcL045gKwhNckz

Here is the complete Front-End Code

1: errorpage.jsx (404 page)

import { NavLink } from "react-router-dom";

export const Error = () => {
  return (
    <>
      <section id="error-page">
        <div className=" content">
          <h2 className="header">404</h2>
          <h4>Sorry! Page not found</h4>
          <p>
            Oops! It seems like the page you're trying to access doesn't exist.
            If you believe there's an issue, feel free to report it, and we'll
            look into it.
          </p>
          <div className="btns">
            <NavLink to="/">return home</NavLink>
            <NavLink to="/contact">report problem</NavLink>
          </div>
        </div>
      </section>
    </>
  );
};

2: Here is the About.jsx code

import { NavLink } from "react-router-dom";
import { Analytics } from "../components/Analytics";

export const About = () => {
  return (
    <>
      <main>
        <section className="section-hero">
          <div className="container grid grid-two-cols">
            <div className="hero-content">
              {/* <p>We care to cure your Health</p> */}

              <h1>Why Choose Us? </h1>
              <p>
                Expertise: Our team consists of experienced IT professionals who
                are passionate about staying up-to-date with the latest industry
                trends.
              </p>
              <p>
                Customization: We understand that every business is unique.
                Thats why we create solutions that are tailored to your specific
                needs and goals.
              </p>
              <p>
                Customer-Centric Approach: We prioritize your satisfaction and
                provide top-notch support to address your IT concerns.
              </p>
              <p>
                Affordability: We offer competitive pricing without compromising
                on the quality of our services.
              </p>
              <p>
                Reliability: Count on us to be there when you need us. We're
                committed to ensuring your IT environment is reliable and
                available 24/7.
              </p>
              <div className="btn btn-group">
                <NavLink to="/contact">
                  <button className="btn"> Connect Now</button>
                </NavLink>
                <button className="btn secondary-btn">learn more</button>
              </div>
            </div>
            <div className="hero-image">
              <img
                src="/images/about.png"
                alt="coding buddies "
                width="400"
                height="500"
              />
            </div>
          </div>
        </section>
      </main>

      <Analytics />
    </>
  );
};

Here is the complete remaining CSS Code

/*? state rules  */

button:hover {
  box-shadow: inset 0 0 0 0.2rem var(--bg-color);
  /* border: 0.2rem solid #fff; */
}

a:hover,
a.active {
  color: #535bf2;
}

/* pseduo elements  */
.main-heading {
  position: relative;
  text-transform: capitalize;

  &::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50%;
    height: 0.5rem;
    background-color: var(--btn-color);
  }
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  a:hover,
  a.active {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}

/* error page  */
#error-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
#error-page .content {
  max-width: 70rem;
  text-align: center;
}
.content h2.header {
  font-size: 18vw;
  line-height: 1em;
  animation: animate 10s ease-in-out infinite;
  background: -webkit-repeating-linear-gradient(
    -60deg,
    #71b7e6,
    var(--btn-color),
    #b98acc,
    #ee8176,
    #b98acc,
    var(--btn-color),
    #9b59b6
  );
  background-size: 500%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.25);
  position: relative;
  -webkit-animation: animate 10s ease-in-out infinite;
}

@keyframes animate {
  0% {
    background-position: 0 0;
  }
  25% {
    background-position: 100% 0;
  }
  50% {
    background-position: 100% 100%;
  }
  75% {
    background-position: 0% 100%;
  }
  100% {
    background-position: 0% 0%;
  }
}
.content h4 {
  margin-bottom: 20px;
  text-transform: uppercase;
  font-size: 2rem;
}

.content .btns {
  margin: 25px 0;
  display: inline-flex;
  justify-content: center;
}
.content .btns a {
  display: inline-block;
  margin: 0 10px;
  text-decoration: none;
  border: 2px solid var(--btn-color);
  color: var(--btn-color);
  font-weight: 500;
  padding: 10px 25px;
  border-radius: 25px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}
.content .btns a:hover {
  background: var(--btn-color);
  color: #fff;
}

/** -----------------------
** registration section css
** -------------------------  */

.section-registration {
  padding: 0 3.2rem;

  & .container {
    /* background-color: #fff; */
    padding-top: 3.2rem;
    align-items: center;

    & img {
      width: 80%;
      height: auto;
    }
  }

  & .registration-form {
    & label {
      display: block;
      margin: 2.4rem 0 0.8rem 0;
      text-transform: capitalize;
    }
    & input {
      width: 80%;
      padding: 0.6rem 0.6rem;
    }

    & button {
      margin-top: 3.2rem;
    }
  }
}

.adminNav ul {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.adminContainer {
  display: grid;
  padding-top: 0;
  grid-template-columns: 1fr 3fr;
}

.adminList {
  flex-direction: column;
  list-style-type: none;
}

.adminList li {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr;
}

/** -----------------------
** services section css
** -------------------------  */

.section-services {
  & .container:first-child {
    padding: 0;
  }
  & .grid-three-cols {
    grid-template-columns: repeat(3, 1fr);
    gap: 3.2rem;
  }

  & .card {
    display: flex;
    flex-direction: column;
    gap: 3.2rem;
    border: 0.2rem solid var(--helper-color);

    & .card-img {
      text-align: center;
      & img {
        width: 70%;
        height: auto;
        filter: drop-shadow(0 0 2rem 2rem #fff);
        -webkit-filter: drop-shadow(0 0 2rem 2rem #fff);
      }
    }

    & .card-details {
      padding: 2.4rem;

      & .grid p {
        font-size: 1.4rem;
      }

      & h2 {
        font-size: 3.2rem;
        margin: 1.2rem 0 2.4rem 0;
      }
    }
  }
}

/** -----------------------
** media query section css
** -------------------------  */

@media (width <= 998px) {
  .grid-two-cols {
    grid-template-columns: 1fr;
  }

  .section-services {
    & .grid-three-cols {
      grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
    }
  }

  .section-registration {
    & .container {
      & .reg-img img {
        width: 60%;
        height: auto;
      }
    }
  }
}

@media (width <= 798px) {
  html {
    font-size: 56.25%;
  }

  .section-registration {
    & .container {
      & .reg-img img {
        width: 50%;
        height: auto;
      }
    }

    & .registration-form {
      & input {
        width: 100%;
        padding: 0.6rem 0.6rem;
      }
    }
  }
}