Giter Club home page Giter Club logo

nba_legends-app_with_lifting-state-up's Introduction

NBA Legends_with_lifting-state-up

πŸ‘‰ Click here to see on browser

lifting state up


What's used in this app ? How use third party libraries Author
lifting state up Take a look at my portfolio
useState() Hook Visit me on Linkedin
Conditional rendering
React-Bootstrap npm i / yarn add react-bootstrap bootstrap
Deploy with Vercel

How To Run This Project πŸš€


πŸ’» Install React πŸ‘‡

yarn create react-app .  or npx create-react-app .

πŸ’» Install Sass πŸ‘‡

yarn add sass  or npm i sass

πŸ”΄ Delete these files and delete the importsπŸ‘‡

- App.test.js
- reportWebVitals.js
- setupTests.js
- favicon.ico
- logo192.png
- logo512.png
- manifest.json
- robots.txt

πŸ’» Start the project πŸ‘‡

yarn start or npm start

OR

  • Clone the Repo

    git clone
  • Install NPM packages

    npm install or yarn
  • Run the project

    npm start or yarn start
  • Open the project on your browser

    http://localhost:3000/
  • Enjoy! πŸŽ‰


Project Skeleton

nba legends (folder)
|
|----public (folder)
β”‚     └── index.html
|----src (folder)
|    |--- components (folder)
β”‚    β”‚       β”œβ”€β”€ ContainerCard.jsx
β”‚    β”‚       β”œβ”€β”€ Header.jsx
β”‚    β”‚       β”œβ”€β”€ PlayerCard.jsx
β”‚    β”‚
|    |--- helper (folder)
|    |       |── data.js
β”‚    β”‚
β”‚    |--- assets (folder)
|    |      β”œβ”€β”€ nba-logo.png
|    |
β”‚    β”œ--- App.js
β”‚    β”‚--- data.js
β”‚    |--- index.js
β”‚    β”œ--- index.css
β”‚
β”‚
|-- .gitignore
|── package-lock.json
β”œβ”€β”€ package.json
|── README.md
|── yarn.lock



At the end of the project, the following topics are to be covered;

  • Lifting state up

    // src/App.jsx
        import CardContainer from "./components/cardcontainer/CardContainer";
    import Header from "./components/header/Header";
    
    import { useState } from "react";
    
    function App() {
       ** const [search, setSearch] = useState(""); **
        return (
            <div>
              **  <Header setSearch={setSearch} />**
              **  <CardContainer search={search} />**
            </div>
        );
    }
    
    export default App;
    
    
    // src/Header.jsx
    import img from "../../assets/nba-logo.png";
    
    **const Header = ({ setSearch }) => {**
        return (
            <div className="text-center mt-4 ">
                <img src={img} alt="" />
                <h1>NBA Legends</h1>
                <input
                    **onChange={(e) => setSearch(e.target.value)}**
                    className="form-control w-50 mx-auto m-5"
                    type="search"
                    name="name"
                    id="name"
                    placeholder="Search Player..."
                />
            </div>
        );
    };
    
    export default Header;
    
    
    
    // src/CardContainer.jsx
    import { data } from "../../helper/data";
    import PlayerCard from "../playercard/PlayerCard.jsx";
    const CardContainer = ({ search }) => {
        return (
            <div className="container">
                <div className=" row ">
                    {data
                        .filter((player) =>
                            player.name
                                .toLocaleLowerCase()
                                .includes(search.trim().toLocaleLowerCase())
                        )
                        .map((player, i) => (
                            <PlayerCard key={i} {...player} />
                        ))}
                </div>
            </div>
        );
    };

export default CardContainer;

    ```
  • conditional rendering

    import Img from "./Img";
    import Ul from "./Ul";
    import "./PlayerCard.css";
    
    import { useState } from "react";
    
    const PlayerCard = ({ img, name, statistics }) => {
        const [visible, setVisible] = useState(true);
    
        const handleClick = () => {
            setVisible(!visible);
        };
    
        return (
            <div
                className=" col col-md-6 col-lg-4 col-xl-3 p-2"
                style={{ height: "450px" }}
            >
                <div onClick={handleClick} className="card h-100 border-0 ">
                    {visible ? (
                        <Img img={img} />
                    ) : (
                        <Ul statistics={statistics} />
                    )}
                    <div className="card-body h-25 ">
                        <h5 className="card-title">{name}</h5>
                    </div>
                </div>
            </div>
        );
    };
    
    export default PlayerCard;
  • yΓΌkseklikleri farkli olan img leri esitlemek icin

    const Img = ({ img }) => {
        return (
            <div className="img-container h-75">
                <img
                    src={img}
                    className="card-img-top h-100 rounded-0"
                    alt="player"
                />
            </div>
        );
    };
    
    export default Img;

Feedback and Collaboration

I value your feedback and suggestions. If you have any comments, questions, or ideas for improvement regarding this project or any of my other projects, please don't hesitate to reach out. I'm always open to collaboration and welcome the opportunity to work on exciting projects together. Thank you for visiting my project. I hope you have a wonderful experience exploring it, and I look forward to connecting with you soon!

βŒ› Happy Coding ✍

nba_legends-app_with_lifting-state-up's People

Contributors

kaplanh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.