Menu

Styling the Layout

Styling the Layout

This CSS file styles the Recipe Finder app, handling layout, colors, fonts, recipe cards, the search bar, the modal, the loader, and error messages, and ensuring the design is responsive across different screen sizes.

File Path: Recipe-Finder\src\App.css

@import "tailwindcss";

.main-wrapper {
  position: relative;
  background-color: #fffbf7;
}

.head-text h1 {
  font-weight: 600;
  color: #ff3838;
}
.head-text h2 {
  font-weight: 500;
  color: #f77f00;
}

.recipe-finder-component {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#search-recipe {
  background: rgb(255, 255, 255);
  outline: none;
  border: 1px solid #a8a8a8;
  border-radius: 18px;
  padding: 6px 80px 6px 12px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.05);
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-icon {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.search-icon:hover {
  cursor: pointer;
}
.clear-icon {
  top: 50%;
  right: 45px;
  transform: translateY(-50%);
  border-right: 1px solid #8d8d8d;
  padding-right: 6px;
}

.clear-icon:hover {
  cursor: pointer;
}

.material-symbols-outlined {
  font-size: 30px;
}

.dish {
  border: 2px solid #d1d1d1;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.img-container {
  /* flex: 1;
  max-height: 300px; */
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.dish img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-text {
  flex-shrink: 0;
}

.dish-text .name {
  font-weight: 400;
}

.dish-text .prep {
  color: #ff0015;
  font-weight: 600;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.closeIcon {
  top: 5px;
  right: 5px;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid #ffbcbc;
  border-top: 4px solid #ff4242;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-msg-container {
  border: 1px solid #ef4c4c;
  border-radius: 8px;
  background: rgb(255 239 237);
  box-shadow: 0 4px 10px rgba(239, 76, 76, 0.1);
}

/* Responsive */

@media (max-width: 767px) {
  #search-recipe {
    padding-right: 64px;
  }
  .clear-icon {
    right: 40px;
  }
  .material-symbols-outlined {
    font-size: 26px;
  }
}

@media (max-width: 648px) {
  #search-recipe {
    padding-top: 2px;
    padding-bottom: 2px;
  }
}