kandi background
Explore Kits

RIBs | Uber's crossplatform mobile architecture framework. | iOS library

 by   uber Java Version: v0.10.0 License: Apache-2.0

 by   uber Java Version: v0.10.0 License: Apache-2.0

Download this library from

kandi X-RAY | RIBs Summary

RIBs is a Java library typically used in Telecommunications, Media, Telecom, Mobile, iOS, Framework applications. RIBs has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. However RIBs build file is not available. You can download it from GitHub.
RIBs is the cross-platform architecture framework behind many mobile apps at Uber. The name RIBs is short for Router, Interactor and Builder, which are core components of this architecture. This framework is designed for mobile apps with a large number of engineers and nested states.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • RIBs has a medium active ecosystem.
  • It has 6831 star(s) with 809 fork(s). There are 203 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 83 open issues and 194 have been closed. On average issues are closed in 218 days. There are 15 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of RIBs is v0.10.0
RIBs Support
Best in #iOS
Average in #iOS
RIBs Support
Best in #iOS
Average in #iOS

quality kandi Quality

  • RIBs has 0 bugs and 0 code smells.
RIBs Quality
Best in #iOS
Average in #iOS
RIBs Quality
Best in #iOS
Average in #iOS

securitySecurity

  • RIBs has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • RIBs code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
RIBs Security
Best in #iOS
Average in #iOS
RIBs Security
Best in #iOS
Average in #iOS

license License

  • RIBs is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
RIBs License
Best in #iOS
Average in #iOS
RIBs License
Best in #iOS
Average in #iOS

buildReuse

  • RIBs releases are available to install and integrate.
  • RIBs has no build file. You will be need to create the build yourself to build the component from source.
  • Installation instructions, examples and code snippets are available.
  • RIBs saves you 5823 person hours of effort in developing the same functionality from scratch.
  • It has 12092 lines of code, 1244 functions and 331 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
RIBs Reuse
Best in #iOS
Average in #iOS
RIBs Reuse
Best in #iOS
Average in #iOS
Top functions reviewed by kandi - BETA

kandi has reviewed RIBs and discovered the below as its top functions. This is intended to give you an instant insight into RIBs implemented functionality, and help decide if they suit your requirements.

  • Generates a RIB .
  • Called when the mouse is active .
  • Returns a list of resources for a class .
  • Sets the visibility of an overlay .
  • Handles the received intent .
  • Gets the generators for an instrument and view .
  • Forward click on square coordinates
  • Install LeakCanary .
  • Handles a deep link activity .
  • Write a debug message .

RIBs Key Features

Shared architecture across iOS and Android. Build cross-platform apps that have similar architecture, enabling iOS and Android teams to cross-review business logic code.

Testability and Isolation. Classes must be easy to unit test and reason about in isolation. Individual RIB classes have distinct responsibilities like: routing, business, view logic, creation. Plus, most RIB logic is decoupled from child RIB logic. This makes RIB classes easy to test and reason about independently.

Tooling for developer productivity. RIBs come with IDE tooling around code generation, memory leak detection, static analysis and runtime integrations - all which improve developer productivity for large teams or small.

An architecture that scales. This architecture has proven to scale to hundreds of engineers working on the same codebase and apps with hundreds of RIBs.

Installation for Android

copy iconCopydownload iconDownload
dependencies {
  annotationProcessor 'com.uber.rib:rib-compiler-test:0.11.2'
  implementation 'com.uber.rib:rib-android:0.11.2'
  testImplementation 'com.uber.rib:rib-test:0.11.2'
}

Installation for iOS

copy iconCopydownload iconDownload
pod 'RIBs', '~> 0.9'

License

copy iconCopydownload iconDownload
Copyright (C) 2017 Uber Technologies

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Javascript Hide/Show div not working on input searchBar

copy iconCopydownload iconDownload
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');

    for (i = 0; i < recipeCard.length; i++) {

        if (input != "" && recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        } else {
            recipeCard[i].style.display = "none";
        }

    }
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>
-----------------------
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');

    for (i = 0; i < recipeCard.length; i++) {

        if (input != "" && recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        } else {
            recipeCard[i].style.display = "none";
        }

    }
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>
-----------------------
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');

    for (i = 0; i < recipeCard.length; i++) {

        if (input != "" && recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        } else {
            recipeCard[i].style.display = "none";
        }

    }
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>
-----------------------
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');
    if(input === ""){
      for (i = 0; i < recipeCard.length; i++) {
        recipeCard[i].style.display = "none";
      }
    }
    else {
      for (i = 0; i < recipeCard.length; i++) {
        if (recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        }
        else {
            recipeCard[i].style.display = "none";

        }
    }
    }
    
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>
-----------------------
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');
    if(input === ""){
      for (i = 0; i < recipeCard.length; i++) {
        recipeCard[i].style.display = "none";
      }
    }
    else {
      for (i = 0; i < recipeCard.length; i++) {
        if (recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        }
        else {
            recipeCard[i].style.display = "none";

        }
    }
    }
    
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>
-----------------------
function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');
    if(input === ""){
      for (i = 0; i < recipeCard.length; i++) {
        recipeCard[i].style.display = "none";
      }
    }
    else {
      for (i = 0; i < recipeCard.length; i++) {
        if (recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        }
        else {
            recipeCard[i].style.display = "none";

        }
    }
    }
    
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>

Show/hide 'div' using JavaScript Not Working with search bar input

copy iconCopydownload iconDownload
for (i = 0; i < recipeCard.length; i++) {
  
// added this
  if( input == ''){
    recipeCard[i].style.display = "none";
  }
// end

   else if (recipeCard[i].textContent.toLowerCase().includes(input)) {
        recipeCard[i].style.display = "block";
    } else if (!recipeCard[i].textContent.toLowerCase().includes(input) && recipeCard[i].style.display === "block") {
        recipeCard[i].style.display = "none";

    } 
}
-----------------------
if(input.length <= 0) {
  recipeCard[i].style.display = "none";
}
-----------------------
function search_recipe() {
let input = document.getElementById('search').value
input = input.toLowerCase();
let recipeCard = document.getElementsByClassName('recipe__card');

for (i = 0; i < recipeCard.length; i++) {

    if (recipeCard[i].textContent.toLowerCase().includes(input)) {
        recipeCard[i].style.display = "block";
    } else if (!recipeCard[i].textContent.toLowerCase().includes(input) && recipeCard[i].style.display === "block") {
        recipeCard[i].style.display = "none";

    }
    if(document.getElementById('search').value==""){
           recipeCard[i].style.display = "none";

}
}
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<h2 class="section__title">Recipe</h2>
        <div class="recipe__filters">
            <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
            <div class="cat">
                <h3>Categories</h3>
                <i class="uil uil-arrow-right" id="categories-button"></i>
            </div>
            <div class="hide_categories" id="h_categories">
                <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                <span class="recipe__item" data-filter='.dessert'>dessert</span>
                <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
            </div>

        </div>
        <div class="recipe__container container">
            <!-- <div class="recipe__card mix ">
                <img src="./asset/img" alt="" class="recipe__img">
                <h3 class="recipe-title-item"></h3>
                <a href="#" class="recipe__button">
                    More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                </a>
            </div> -->
            <div class="recipe__card mix">
                <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Helllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">aelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix burgersandwiches">
                <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Zelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Ribs</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>

    </section>
-----------------------
function search_recipe() {
let input = document.getElementById('search').value
input = input.toLowerCase();
let recipeCard = document.getElementsByClassName('recipe__card');

for (i = 0; i < recipeCard.length; i++) {

    if (recipeCard[i].textContent.toLowerCase().includes(input)) {
        recipeCard[i].style.display = "block";
    } else if (!recipeCard[i].textContent.toLowerCase().includes(input) && recipeCard[i].style.display === "block") {
        recipeCard[i].style.display = "none";

    }
    if(document.getElementById('search').value==""){
           recipeCard[i].style.display = "none";

}
}
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<h2 class="section__title">Recipe</h2>
        <div class="recipe__filters">
            <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
            <div class="cat">
                <h3>Categories</h3>
                <i class="uil uil-arrow-right" id="categories-button"></i>
            </div>
            <div class="hide_categories" id="h_categories">
                <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                <span class="recipe__item" data-filter='.dessert'>dessert</span>
                <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
            </div>

        </div>
        <div class="recipe__container container">
            <!-- <div class="recipe__card mix ">
                <img src="./asset/img" alt="" class="recipe__img">
                <h3 class="recipe-title-item"></h3>
                <a href="#" class="recipe__button">
                    More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                </a>
            </div> -->
            <div class="recipe__card mix">
                <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Helllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">aelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix burgersandwiches">
                <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Zelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Ribs</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>

    </section>
-----------------------
function search_recipe() {
let input = document.getElementById('search').value
input = input.toLowerCase();
let recipeCard = document.getElementsByClassName('recipe__card');

for (i = 0; i < recipeCard.length; i++) {

    if (recipeCard[i].textContent.toLowerCase().includes(input)) {
        recipeCard[i].style.display = "block";
    } else if (!recipeCard[i].textContent.toLowerCase().includes(input) && recipeCard[i].style.display === "block") {
        recipeCard[i].style.display = "none";

    }
    if(document.getElementById('search').value==""){
           recipeCard[i].style.display = "none";

}
}
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}
<h2 class="section__title">Recipe</h2>
        <div class="recipe__filters">
            <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
            <div class="cat">
                <h3>Categories</h3>
                <i class="uil uil-arrow-right" id="categories-button"></i>
            </div>
            <div class="hide_categories" id="h_categories">
                <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                <span class="recipe__item" data-filter='.dessert'>dessert</span>
                <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
            </div>

        </div>
        <div class="recipe__container container">
            <!-- <div class="recipe__card mix ">
                <img src="./asset/img" alt="" class="recipe__img">
                <h3 class="recipe-title-item"></h3>
                <a href="#" class="recipe__button">
                    More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                </a>
            </div> -->
            <div class="recipe__card mix">
                <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Helllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">aelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix burgersandwiches">
                <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix">
                <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Zelllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Telllllllo</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>
            <div class="recipe__card mix ">
                <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                <h3 class="recipe-title-item">Ribs</h3>
                <a href="#" class="blog__button">
                    More details <i class='uil uil-angle-right-b blog__icon'></i> 
                </a>
            </div>

    </section>
-----------------------
if (input == "") {
    Array.from(recipeCard).forEach(card => {
        card.style.display = "none"
    });
}

Difference in getClientRects() results across browsers

copy iconCopydownload iconDownload
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
-----------------------
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
-----------------------
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
-----------------------
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
-----------------------
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
-----------------------
var el = document.getElementById("parent");
// Element#getClientRects();
var clientRects = el.getClientRects();
console.log(clientRects.length); // 1 everywhere
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.getElementById('parent');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // 2 in Firefox
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>
var el = document.querySelector('.child');
var range = document.createRange();
// select the content, not the node itself
range.selectNodeContents(el);
var clientRects = range.getClientRects();
console.log(clientRects.length); // all browsers agree, 1 box per line
<div class="parent" id='parent'>
    <div class="child">Bacon ipsum dolor amet meatball bresaola t-bone tri-tip brisket. Jowl pig picanha cupim landjaeger, frankfurter spare ribs chicken. Porchetta jowl pancetta drumstick shankle cow spare ribs jerky tail kevin biltong capicola brisket venison bresaola. Flank sirloin jowl andouille meatball venison salami ground round rump boudin turkey capicola t-bone. Sirloin filet mignon tenderloin beef, biltong doner bresaola brisket shoulder pork loin shankle turducken shank cow. Bacon ball tip sirloin ham.
    </div>
    <div id="info">Click somewhere in the paragraph above</div>
</div>

Variable assignment from JSON not setting all the values at the same time (React) and returning undefined for one variable

copy iconCopydownload iconDownload
const RecipePage = () => {

const [isLoading, setIsLoading] = useState(false);
const [data, setData] = useState([]);
const params = useParams();
const recipeSlug = params.recipeSlug;
const recipeID = params.id;

useEffect(() => {
   setIsLoading(true)
    const options = {
        method: 'GET',
        url: 'https://tasty.p.rapidapi.com/recipes/detail',
        params: { id: recipeID },
        headers: {
            'x-rapidapi-host': 'tasty.p.rapidapi.com',
            'x-rapidapi-key': process.env.REACT_APP_RAPID_API_KEY
        }
    };

    const fetchData = async () => {
        const recipeInstructions = await axios.request(options);
        setData(recipeInstructions.data);
        console.log(recipeInstructions.data);
        console.log(data);
    }
    fetchData().catch(console.error);
    setIsLoading(false)
}, []);

const { name, country, slug, instructions, beauty_url } = data;

console.log(data.instructions);
console.log(name);
if(isLoading) {
return (
<div> here dispolay a gif loading </div>
)};
return (
    
    <>
        <header className="topBar">
            <Link to={`/`} className='normal'>
                <div className='title'>
                    <SectionTitle titleText="Test Test" />
                    <SectionTitle titleText="Cooking Club" />
                </div>
            </Link>
        </header>
        <div>
            <SectionTitle titleText={name} />
            <div className="image">
                <img src={beauty_url} alt="recipe" />
            </div>
        </div>
        <section>
            <p>Serves {data.num_servings} </p>
            <p>Prep Time {data.num_servings} </p>
        </section>
        <section>
            <h3>Ingredients</h3>
        </section>
        <div>{country}</div>
        <div>{slug}</div>
        <div>slug: {recipeSlug}</div>
        <RecipeInstructions instructions={instructions} />         
    </>
)

Flexbox Directions and multiple images within

copy iconCopydownload iconDownload
.food-container{
  display: grid;
  grid-template-columns: auto auto auto; /*that should do it*/
}

Ruby Faker Library with JSONB in PostgreSQL db

copy iconCopydownload iconDownload
UPDATE table_name SET column_name = to_json(column_name);
  rand(6).times do
    con.connectors_data.create(
      version: Faker::Number.number(digits: 5),
      metadata: JSON.parse(Faker::Json.shallow_json(width: 3, options: { key: "Name.first_name", value: "Food.dish" })),
      comment: Faker::Lorem.sentence
    )
  end
-----------------------
UPDATE table_name SET column_name = to_json(column_name);
  rand(6).times do
    con.connectors_data.create(
      version: Faker::Number.number(digits: 5),
      metadata: JSON.parse(Faker::Json.shallow_json(width: 3, options: { key: "Name.first_name", value: "Food.dish" })),
      comment: Faker::Lorem.sentence
    )
  end

Google Sheet Apps Script : How to sort JSON objects based on Order ID

copy iconCopydownload iconDownload
// 1. Retrieve source and destination sheets.
const ss = SpreadsheetApp.getActiveSpreadsheet();
//maps srcSheet to Order_List, dstSheet to Order_MenuList
const [srcSheet, dstSheet] = ["Order_List", "Order_Menu_List"].map(s => ss.getSheetByName(s));

// 2. Retrieve values from source sheet.
const [head, ...values] = srcSheet.getRange("A1:C" + srcSheet.getLastRow()).getDisplayValues();

// 3. Create an array for putting to the destination sheet using the header value.
const headers = ["dish_name", "dish_price", "dish_quantity", "dish_size_name", "dish_size_price", "dish_addon_name", "dish_addon_price", "dish_variation_name", "dish_variation_price"];
const ar = [[head[0], head[1], ...headers], ...values.flatMap(([a, b, c]) => Object.entries(JSON.parse(c)).map(([, v], i) => [...(i == 0 ? [a, b] : ["", ""]), ...headers.map(h => v[h] || "")]))];

// 4. Put the array to the destination sheet.
const range = dstSheet.getRange(1, 1, ar.length, ar[0].length);
range.offset(0, 0, ar.length, 1).setNumberFormat("@");
range.setValues(ar);

Add navbar below logo and center the content

copy iconCopydownload iconDownload
/***************GENERAL***************/

html, body {
  color: #434242;
  font-family: sans-serif;
  font-size: 100%;
  background-image: linear-gradient( rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6) ), url("https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  margin:0;
padding:0;
}

li {
  padding: 0 1.25rem;
}

p,
li {
  font-family: sans-serif;
  color: rgb(0, 0, 0);
  text-align: left;
}


/***************SITE HEADER***************/

header {
  align-items: center;
  display: flex;
  height: 4.0625rem;
  justify-content: space-between;
  width: 100%;
}

.logo {
  margin-left: 50px;
  display: inline;
  font-weight: 500;
  text-transform: uppercase;
  color: white;
}

nav {
  margin-right: 25px;
  
}

header li {
  font-weight: 300;
  display: inline;
}

a {
  color: rgb(255, 255, 255);
  text-decoration: none;
}

.intro {
float: right;
margin-top: 100px;
margin-right: 300px;
}
.intro li {
  color: rgb(255, 255, 255);
  text-align: center;
  padding: 10px;
  font-family: "Press Start 2P", sans-serif;
}


/***************MAIN***************/

main {
  align-items: center;
background-color: rgb(230, 230, 230);
  display: flex;
  height: auto;
  justify-content: center;
  margin-top: 30rem;
  position: relative;
  text-align: center;
  padding-bottom: 50px;
  padding-top: 5px;
}

img {
  width: 250px;
  height: 250px;
  overflow: hidden;
  border-radius: 100%;
  margin: -80px auto 0 ;
  border: 10px solid white;
}

#leftpic
{
margin-right: 50%;
}

#rightpic
{
  margin-left: 25%;
}

h2 {
  font-size: 25px;
  font-weight: normal;
}


.rows {
  display: grid;
  grid-auto-flow: column;
  gap: 2%;
  margin-top: 25px;
  margin-right: 80px;
  margin-left: 80px;
}

.col {
  border: 1px solid lightgrey;
  background-color: rgb(255, 255, 255);
padding: 20px;
}



/***************FOOTER***************/

footer {
  height: 9.375rem;
  margin-top: 1.25rem;
  margin-left: 250px;
}
 
small  {
  color:white;
}

.left{
  float: left;
  width: 33.333%;
  }
  .right{
    float: right;
    width: 33.333%;
  }
  .centered{
    display: inline-block;
    width: 33.333%;
  }


/***************MEDIA QUERIES***************/



/***************Laptop***************/
@media only screen and (max-width: 1024px) {

  #rightpic
  {
    margin-left: 20%;
  }

  #leftpic
  {
    margin-left: -20%;
  }
  img
  {
    width: 90%;
    height: 15%;
  }

/***************Tablet***************/
@media only screen and (max-width: 768px) {

  img
  {
    width: 40%;
    height: 5%;
  }
  
  .rows {
    display: inline-block;
  }

  .col {
    margin-bottom: 20%;
    
  }

  #leftpic {
margin: auto;
margin-top: -15%;
  }

  #rightpic {
    margin: auto;
    margin-top: -15%;
  }


footer {
  margin-left: 20%;
    }

  .logo {
margin: 0 auto;
    float: none;
display: block;
text-align: center;
width: 100%;
  }
  header {
    display: block;
  }
  nav {
    display: block;
    text-align: center;
  }
  }
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
    <title>Ett Namn</title>
  </head>
  <body>

    <!-- Sidhuvud -->
    <header>
        <h1 class="logo">👨‍💻 Ett Namn</h1>

          <!-- Meny -->
          <nav>
            <ul>
           <li><a href="index.html">🏠 Hem</a></li>
          <li><a href="portfolio.html">📁 Portfolio</a></li>
          <li><a href="rapport.html">📋 Rapport</a></li>
          </li>
          </ul>
          </div>
      </nav>
    </div>
  </div>
  
    </header>

    <div class="intro">
      <h1><ul style="list-style-type:none;">
        <li> 🖥️ Webbsidor</li>
        <li>📱 Webbappar</li>
        <li>🎮 Datorspel</li>
      </ul></h1>
    </div>

      <!-- Main -->
      <main>
          <div class="rows">
            <div class="col">
              <img id="leftpic" src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
              <h2>Kodar webbsidor och webbappar.</h2>
              <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.
              Cum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. Pestilentia est plague haec decaying ambulabat mortuos. Sicut zeder apathetic malus voodoo. Aenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. Qui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. Alii missing oculis aliorum sicut serpere crabs nostram. Putridi braindead odores kill and infect, aere implent left four dead.</p>
              <br>
              <p>Cum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. Pestilentia est plague haec decaying ambulabat mortuos. Sicut zeder apathetic malus voodoo. Aenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. Qui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. Alii missing oculis aliorum sicut serpere crabs nostram. Putridi braindead odores kill and infect, aere implent left four dead.</p>
            </div>
            

              <div class="col">
                <img src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
                <h2>Webmaster student som kommer från Umeå.</h2>
                <p>Bacon ipsum dolor amet enim nisi jowl, beef aliquip ground round cupim tempor pastrami chislic magna adipisicing. Ex aliquip tenderloin swine incididunt do enim. Leberkas hamburger ex labore, ipsum esse porchetta. Ut voluptate biltong cupim t-bone meatloaf aute tri-tip rump filet mignon do ullamco laborum ham hock minim.
              In eu voluptate, ullamco bacon in meatball minim biltong reprehenderit boudin aliquip ball tip ut sausage. Cupim beef ribs turducken brisket id proident swine aute mollit meatball venison meatloaf boudin. Kielbasa voluptate pig, ham hock pork belly tempor excepteur sirloin fatback chuck spare ribs mollit. Jerky jowl ex, pariatur aliquip tri-tip beef tail minim shankle.</p>
              <br>
              <p>In eu voluptate, ullamco bacon in meatball minim biltong reprehenderit boudin aliquip ball tip ut sausage. Cupim beef ribs turducken brisket id proident swine aute mollit meatball venison meatloaf boudin. Kielbasa voluptate pig, ham hock pork belly tempor excepteur sirloin fatback chuck spare ribs mollit. Jerky jowl ex, pariatur aliquip tri-tip beef tail minim shankle.</p>
            </div>

            <div class="col">
              <img  id="rightpic" src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
              <h2>Producerar spel till PC och Steam Deck.</h2>
              <p>Godard shoreditch aesthetic, deep v organic austin tofu. Farm-to-table tumeric fixie tattooed photo booth ethical banh mi narwhal iceland 90's bitters messenger bag. Austin gentrify put a bird on it live-edge, cardigan man braid vice distillery activated charcoal heirloom sriracha snackwave yr venmo unicorn. Brooklyn paleo beard live-edge tbh, unicorn fingerstache gochujang occupy sustainable mlkshk poke street art fanny pack. Prism brunch YOLO, authentic tbh polaroid fingerstache narwhal typewriter green juice kitsch gochujang crucifix twee.</p>
              <br>
              <p>Jean shorts portland hella jianbing four dollar toast wolf migas. Polaroid cronut sriracha, post-ironic plaid fashion axe austin irony actually stumptown celiac whatever hexagon hoodie coloring book. Kombucha keytar hella austin cardigan woke you probably haven't heard of them pinterest sartorial jianbing microdosing tbh. Kickstarter paleo asymmetrical, vegan pop-up you probably haven't heard of them fam microdosing man braid affogato. Banjo cliche small batch salvia edison bulb prism microdosing 8-bit before they sold out chillwave truffaut drinking vinegar. Cliche intelligentsia butcher taxidermy occupy chambray leggings mlkshk pug wayfarers. Cornhole irony thundercats, poutine wayfarers heirloom cardigan.</p>
              </div>
          </div>

      </main>

    <!-- Footer -->
    <footer>

    <small class="left"> <h3>Adress</h3>
    <br /><br />Kungsgatan 108
    <br />90332 Umeå</small>

    <small class="right"> <h3>Telefon</h3>
      <br /><br />0702815540</small>

    <small class="centered"><h3>E-Post</h3>
      <br /><br />Mail.com</small>
    </footer>
  </body>
</html>
-----------------------
/***************GENERAL***************/

html, body {
  color: #434242;
  font-family: sans-serif;
  font-size: 100%;
  background-image: linear-gradient( rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6) ), url("https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  margin:0;
padding:0;
}

li {
  padding: 0 1.25rem;
}

p,
li {
  font-family: sans-serif;
  color: rgb(0, 0, 0);
  text-align: left;
}


/***************SITE HEADER***************/

header {
  align-items: center;
  display: flex;
  height: 4.0625rem;
  justify-content: space-between;
  width: 100%;
}

.logo {
  margin-left: 50px;
  display: inline;
  font-weight: 500;
  text-transform: uppercase;
  color: white;
}

nav {
  margin-right: 25px;
  
}

header li {
  font-weight: 300;
  display: inline;
}

a {
  color: rgb(255, 255, 255);
  text-decoration: none;
}

.intro {
float: right;
margin-top: 100px;
margin-right: 300px;
}
.intro li {
  color: rgb(255, 255, 255);
  text-align: center;
  padding: 10px;
  font-family: "Press Start 2P", sans-serif;
}


/***************MAIN***************/

main {
  align-items: center;
background-color: rgb(230, 230, 230);
  display: flex;
  height: auto;
  justify-content: center;
  margin-top: 30rem;
  position: relative;
  text-align: center;
  padding-bottom: 50px;
  padding-top: 5px;
}

img {
  width: 250px;
  height: 250px;
  overflow: hidden;
  border-radius: 100%;
  margin: -80px auto 0 ;
  border: 10px solid white;
}

#leftpic
{
margin-right: 50%;
}

#rightpic
{
  margin-left: 25%;
}

h2 {
  font-size: 25px;
  font-weight: normal;
}


.rows {
  display: grid;
  grid-auto-flow: column;
  gap: 2%;
  margin-top: 25px;
  margin-right: 80px;
  margin-left: 80px;
}

.col {
  border: 1px solid lightgrey;
  background-color: rgb(255, 255, 255);
padding: 20px;
}



/***************FOOTER***************/

footer {
  height: 9.375rem;
  margin-top: 1.25rem;
  margin-left: 250px;
}
 
small  {
  color:white;
}

.left{
  float: left;
  width: 33.333%;
  }
  .right{
    float: right;
    width: 33.333%;
  }
  .centered{
    display: inline-block;
    width: 33.333%;
  }


/***************MEDIA QUERIES***************/



/***************Laptop***************/
@media only screen and (max-width: 1024px) {

  #rightpic
  {
    margin-left: 20%;
  }

  #leftpic
  {
    margin-left: -20%;
  }
  img
  {
    width: 90%;
    height: 15%;
  }

/***************Tablet***************/
@media only screen and (max-width: 768px) {

  img
  {
    width: 40%;
    height: 5%;
  }
  
  .rows {
    display: inline-block;
  }

  .col {
    margin-bottom: 20%;
    
  }

  #leftpic {
margin: auto;
margin-top: -15%;
  }

  #rightpic {
    margin: auto;
    margin-top: -15%;
  }


footer {
  margin-left: 20%;
    }

  .logo {
margin: 0 auto;
    float: none;
display: block;
text-align: center;
width: 100%;
  }
  header {
    display: block;
  }
  nav {
    display: block;
    text-align: center;
  }
  }
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
    <title>Ett Namn</title>
  </head>
  <body>

    <!-- Sidhuvud -->
    <header>
        <h1 class="logo">👨‍💻 Ett Namn</h1>

          <!-- Meny -->
          <nav>
            <ul>
           <li><a href="index.html">🏠 Hem</a></li>
          <li><a href="portfolio.html">📁 Portfolio</a></li>
          <li><a href="rapport.html">📋 Rapport</a></li>
          </li>
          </ul>
          </div>
      </nav>
    </div>
  </div>
  
    </header>

    <div class="intro">
      <h1><ul style="list-style-type:none;">
        <li> 🖥️ Webbsidor</li>
        <li>📱 Webbappar</li>
        <li>🎮 Datorspel</li>
      </ul></h1>
    </div>

      <!-- Main -->
      <main>
          <div class="rows">
            <div class="col">
              <img id="leftpic" src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
              <h2>Kodar webbsidor och webbappar.</h2>
              <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.
              Cum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. Pestilentia est plague haec decaying ambulabat mortuos. Sicut zeder apathetic malus voodoo. Aenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. Qui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. Alii missing oculis aliorum sicut serpere crabs nostram. Putridi braindead odores kill and infect, aere implent left four dead.</p>
              <br>
              <p>Cum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. Pestilentia est plague haec decaying ambulabat mortuos. Sicut zeder apathetic malus voodoo. Aenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. Qui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. Alii missing oculis aliorum sicut serpere crabs nostram. Putridi braindead odores kill and infect, aere implent left four dead.</p>
            </div>
            

              <div class="col">
                <img src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
                <h2>Webmaster student som kommer från Umeå.</h2>
                <p>Bacon ipsum dolor amet enim nisi jowl, beef aliquip ground round cupim tempor pastrami chislic magna adipisicing. Ex aliquip tenderloin swine incididunt do enim. Leberkas hamburger ex labore, ipsum esse porchetta. Ut voluptate biltong cupim t-bone meatloaf aute tri-tip rump filet mignon do ullamco laborum ham hock minim.
              In eu voluptate, ullamco bacon in meatball minim biltong reprehenderit boudin aliquip ball tip ut sausage. Cupim beef ribs turducken brisket id proident swine aute mollit meatball venison meatloaf boudin. Kielbasa voluptate pig, ham hock pork belly tempor excepteur sirloin fatback chuck spare ribs mollit. Jerky jowl ex, pariatur aliquip tri-tip beef tail minim shankle.</p>
              <br>
              <p>In eu voluptate, ullamco bacon in meatball minim biltong reprehenderit boudin aliquip ball tip ut sausage. Cupim beef ribs turducken brisket id proident swine aute mollit meatball venison meatloaf boudin. Kielbasa voluptate pig, ham hock pork belly tempor excepteur sirloin fatback chuck spare ribs mollit. Jerky jowl ex, pariatur aliquip tri-tip beef tail minim shankle.</p>
            </div>

            <div class="col">
              <img  id="rightpic" src="https://images.unsplash.com/photo-1612099452850-ed8efe7d58ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80">
              <h2>Producerar spel till PC och Steam Deck.</h2>
              <p>Godard shoreditch aesthetic, deep v organic austin tofu. Farm-to-table tumeric fixie tattooed photo booth ethical banh mi narwhal iceland 90's bitters messenger bag. Austin gentrify put a bird on it live-edge, cardigan man braid vice distillery activated charcoal heirloom sriracha snackwave yr venmo unicorn. Brooklyn paleo beard live-edge tbh, unicorn fingerstache gochujang occupy sustainable mlkshk poke street art fanny pack. Prism brunch YOLO, authentic tbh polaroid fingerstache narwhal typewriter green juice kitsch gochujang crucifix twee.</p>
              <br>
              <p>Jean shorts portland hella jianbing four dollar toast wolf migas. Polaroid cronut sriracha, post-ironic plaid fashion axe austin irony actually stumptown celiac whatever hexagon hoodie coloring book. Kombucha keytar hella austin cardigan woke you probably haven't heard of them pinterest sartorial jianbing microdosing tbh. Kickstarter paleo asymmetrical, vegan pop-up you probably haven't heard of them fam microdosing man braid affogato. Banjo cliche small batch salvia edison bulb prism microdosing 8-bit before they sold out chillwave truffaut drinking vinegar. Cliche intelligentsia butcher taxidermy occupy chambray leggings mlkshk pug wayfarers. Cornhole irony thundercats, poutine wayfarers heirloom cardigan.</p>
              </div>
          </div>

      </main>

    <!-- Footer -->
    <footer>

    <small class="left"> <h3>Adress</h3>
    <br /><br />Kungsgatan 108
    <br />90332 Umeå</small>

    <small class="right"> <h3>Telefon</h3>
      <br /><br />0702815540</small>

    <small class="centered"><h3>E-Post</h3>
      <br /><br />Mail.com</small>
    </footer>
  </body>
</html>

R shiny reactive value does not recalculate when called from DT::renderDT

copy iconCopydownload iconDownload
if(is.null(input$InSelect_Recipe_Tags))
if(is.null(input$InSelect_RecipeTags))
-----------------------
if(is.null(input$InSelect_Recipe_Tags))
if(is.null(input$InSelect_RecipeTags))

How do I go about using an exported SVG on a site and how do I make its components interactive?

copy iconCopydownload iconDownload
// find everything in the svg with a data-part attribute
const parts = document.querySelectorAll('svg [data-part]');

// register a click listener on all the parts
parts.forEach(p => p.addEventListener('click', (e) => {

  // get the data-part value from the clicked element
  const {part} = e.target.dataset
  
  // do whatever you need to do with it
  console.log(part);
}))
<?xml version="1.0" encoding="UTF-8"?>
<svg width="210mm" height="297mm" version="1.1" viewBox="0 0 210 297" xmlns="http://www.w3.org/2000/svg">
 <g fill-rule="evenodd" stroke-width=".26458">
  <rect id="bluerect" x="10" y="10" width="20" height="20" fill="#00f" data-part="square"/>
  <circle id="redcircle" cx="42" cy="20" r="10" fill="#f00" data-part="circle"/>
 </g>
</svg>
-----------------------
// find everything in the svg with a data-part attribute
const parts = document.querySelectorAll('svg [data-part]');

// register a click listener on all the parts
parts.forEach(p => p.addEventListener('click', (e) => {

  // get the data-part value from the clicked element
  const {part} = e.target.dataset
  
  // do whatever you need to do with it
  console.log(part);
}))
<?xml version="1.0" encoding="UTF-8"?>
<svg width="210mm" height="297mm" version="1.1" viewBox="0 0 210 297" xmlns="http://www.w3.org/2000/svg">
 <g fill-rule="evenodd" stroke-width=".26458">
  <rect id="bluerect" x="10" y="10" width="20" height="20" fill="#00f" data-part="square"/>
  <circle id="redcircle" cx="42" cy="20" r="10" fill="#f00" data-part="circle"/>
 </g>
</svg>

Community Discussions

Trending Discussions on RIBs
  • Javascript Hide/Show div not working on input searchBar
  • Show/hide 'div' using JavaScript Not Working with search bar input
  • Difference in getClientRects() results across browsers
  • Variable assignment from JSON not setting all the values at the same time (React) and returning undefined for one variable
  • Flexbox Directions and multiple images within
  • Ruby Faker Library with JSONB in PostgreSQL db
  • Google Sheet Apps Script : How to sort JSON objects based on Order ID
  • Add navbar below logo and center the content
  • R shiny reactive value does not recalculate when called from DT::renderDT
  • How do I go about using an exported SVG on a site and how do I make its components interactive?
Trending Discussions on RIBs

QUESTION

Javascript Hide/Show div not working on input searchBar

Asked 2022-Mar-28 at 14:29

I'm having trouble running javascript hide/show div using CSS classes, the initial state all the divs are hidden than when i type in the searchBar the name of the recipe (like the div ribs) it show only the ribs div and so far is working, but when i clear the searchBar its show all the div instead of hiding all of them again.

HTML

<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>

CSS

.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}

.recipe-title-item {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
    margin-bottom: var(--mb-0-75);
}

.hide_categories {
    display: none;
    transition: all ease-in-out;
}

.categories {
    display: grid;
    padding-bottom: 2rem;
    transition: all ease-in-out;
    grid-template-columns: repeat(4, max-content);
}

#categories-button {
    z-index: 9;
}

.cat {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

#categories-button {
    margin-left: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.active-recipe {
    background-color: var(--first-color);
    color: var(--white-color);
}

input[type="text"],
input[type="email"],
textarea[type="text"],
select {
    padding-left: 1rem;
}

.recipe {
    display: block;
}

JAVASCRIPT

function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');

    for (i = 0; i < recipeCard.length; i++) {

        if (recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        } else {
            recipeCard[i].style.display = "none";

        }
    }
}

ANSWER

Answered 2022-Mar-28 at 14:29

function search_recipe() {
    let input = document.getElementById('search').value
    input = input.toLowerCase();
    let recipeCard = document.getElementsByClassName('recipe__card');

    for (i = 0; i < recipeCard.length; i++) {

        if (input != "" && recipeCard[i].textContent.toLowerCase().includes(input)) {
            recipeCard[i].style.display = "block";
        } else {
            recipeCard[i].style.display = "none";
        }

    }
}
.recipe__container {
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.recipe__filters {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: .75rem;
    flex-direction: column;
}

.recipe__item {
    cursor: pointer;
    color: var(--title-color);
    padding: .25rem .75rem;
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__items {
    cursor: pointer;
    color: var(--title-color);
    font-weight: var(--font-medium);
    border-radius: .5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipe__card {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1rem;
    border-radius: 1rem;
    display: none;
}

.recipe__img {
    border-radius: 1rem;
    margin-bottom: var(--mb-1-25);
    width: 230px;
}
<section class="recipe section" id="work">
            <h2 class="section__title">Recipe</h2>
            <div class="recipe__filters">
                <input type="text" onkeyup="search_recipe()" placeholder="search" id="search" class="section__search"></input>
                <div class="cat">
                    <h3>Categories</h3>
                    <i class="uil uil-arrow-right" id="categories-button"></i>
                </div>
                <div class="hide_categories" id="h_categories">
                    <span class="all recipe__item active-recipe " data-filter='all'>All </span>
                    <span class="recipe__item" data-filter='.breakfast'>Breakfast</span>
                    <span class="recipe__item" data-filter='.dessert'>dessert</span>
                    <span class="recipe__item" data-filter='.burgersandwiches'>Burger & Sandwiches</span>
                </div>

            </div>
            <div class="recipe__container container">
                <!-- <div class="recipe__card mix ">
                    <img src="./asset/img" alt="" class="recipe__img">
                    <h3 class="recipe-title-item"></h3>
                    <a href="#" class="recipe__button">
                        More details <i class='uil uil-angle-right-b recipe__icon'></i> 
                    </a>
                </div> -->
                <div class="recipe__card mix">
                    <img src="./asset/img/ramen_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Helllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/burrito_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">aelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix burgersandwiches">
                    <img src="./asset/img/burger_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix">
                    <img src="./asset/img/chips_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/raspberry_brownies_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/steaks_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Zelllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/shrimp_pasta_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Telllllllo</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>
                <div class="recipe__card mix ">
                    <img src="./asset/img/ribs_recipe.jpeg" alt="" class="recipe__img">
                    <h3 class="recipe-title-item">Ribs</h3>
                    <a href="#" class="blog__button">
                        More details <i class='uil uil-angle-right-b blog__icon'></i> 
                    </a>
                </div>

        </section>

All I added is the following condition inside the for-loop: input != ""

If the input is blank, the program will jump to the else statement which hides the recipeCards.

Source https://stackoverflow.com/questions/71648405

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install RIBs

To integrate the recommended minimum setup for RIBs add the following to your build.gradle:.
To integrate RIBs into your project add the following to your Podfile:.

Support

To get started with RIBs, please refer to the RIBs documentation. This describes key concepts on RIBs, from what they are for, their structure and common use cases. To get more hands on with RIBs, we have written a series of tutorials that run you through the main aspects of the architecture with hands-on examples. To read about the backstory on why we created RIBs, see this blog post we wrote when releasing RIBs in production the first time and see this short video where we discussed how the RIBs architecture works.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.