Skip to content

Add like a place functionality(Frontend) #2

Open

Description

@amogh-nagar

Add a button to every post, which likes a particular place.

Activity

  1. changed the title [-]Add like a place functionality[/-] [+]Add like a place functionality(Frontend)[/+] on Oct 4, 2021
  2. shikhar13012001 commented on Oct 5, 2021

    @shikhar13012001
    Contributor

    I would like to work on this, Please assign it to me

  3. amogh-nagar commented on Oct 5, 2021

    @amogh-nagar
    MemberAuthor

    Sure go for it, Happy Hacking!

  4. shikhar13012001 commented on Oct 5, 2021

    @shikhar13012001
    Contributor

    Could you please tell me the targeted files and how much functionality are you expecting on the frontend part?

  5. amogh-nagar commented on Oct 7, 2021

    @amogh-nagar
    MemberAuthor

    Could you please tell me the targeted files and how much functionality are you expecting on the frontend part?

    Yeah you can go for the PlaceItems.js file which is basically all the places, and then If I hit the like button, we should call a function, But for now don't do anything in that function (We will call an API in this function later). For now you just have to customize PlaceItems.js file to add a Like button.

  6. shikhar13012001 commented on Oct 7, 2021

    @shikhar13012001
    Contributor

    Could you please tell me the targeted files and how much functionality are you expecting on the frontend part?

    Yeah you can go for the PlaceItems.js file which is basically all the places, and then If I hit the like button, we should call a function, But for now don't do anything in that function (We will call an API in this function later). For now you just have to customize PlaceItems.js file to add a Like button.

    Ok sir , I understand it , thankyou

  7. shikhar13012001 commented on Oct 8, 2021

    @shikhar13012001
    Contributor

    Could you please tell me the targeted files and how much functionality are you expecting on the frontend part?

    Yeah you can go for the PlaceItems.js file which is basically all the places, and then If I hit the like button, we should call a function, But for now don't do anything in that function (We will call an API in this function later). For now you just have to customize PlaceItems.js file to add a Like button.

    @Amoghtech Sir, I have added the like button as such, modifying the PlaceItems.js
    added LIKE_SVG , made an assets folder in frontend/src and importing the SVG by
    import LIKE_SVG from "../../assets/heart-fill.svg"

       {auth.userId === props.creatorId && (
                  <Button inverse onClick={handleLike}>
                    <img src={LIKE_SVG} />
                  </Button>
                )}
    

  8. amogh-nagar commented on Oct 9, 2021

    @amogh-nagar
    MemberAuthor

    Could you please tell me the targeted files and how much functionality are you expecting on the frontend part?

    Yeah you can go for the PlaceItems.js file which is basically all the places, and then If I hit the like button, we should call a function, But for now don't do anything in that function (We will call an API in this function later). For now you just have to customize PlaceItems.js file to add a Like button.

    @Amoghtech Sir, I have added the like button as such, modifying the PlaceItems.js added LIKE_SVG , made an assets folder in frontend/src and importing the SVG by import LIKE_SVG from "../../assets/heart-fill.svg"

       {auth.userId === props.creatorId && (
                  <Button inverse onClick={handleLike}>
                    <img src={LIKE_SVG} />
                  </Button>
                )}
    

    Great man! Just remove the border color of this svg and then let me know, I'll merge it
    And does this image has a hover effect?

  9. shikhar13012001 commented on Oct 9, 2021

    @shikhar13012001
    Contributor

    @Amoghtech I actually used Button component and made it's innerHTML as SVG , yes it has the hover effect same as View on map, I will make it better in design , thankyou

  10. shikhar13012001 commented on Oct 10, 2021

    @shikhar13012001
    Contributor

    @Amoghtech sir, I have a hover effect in the SVG using two SVGs
    using the following code , I have made use of two SVG, please review the changes and let me know if you need some changes.

                 <span style={{position:'relative'}}>
                    <img src={LOVE_SVG} 
                    onMouseEnter={handleMouseEnter} 
                    onMouseLeave={handleMouseLeave} 
                    onClick={handleLike} 
                    className="like_btn"/>
                 </span>
                )} 
    
     const handleLike=()=>{
        // make API call to the backend
      }
      const handleMouseEnter=(e)=>{
         e.target.src=LIKE_SVG;
      }
      const handleMouseLeave=(e)=>{
        e.target.src=LOVE_SVG;
      }
    

    --

    screenshot


  11. amogh-nagar commented on Oct 10, 2021

    @amogh-nagar
    MemberAuthor

    Yeah nice, Just add a left margin as well, It's quite close to the DELETE button and also ensure that it's responsive

  12. shikhar13012001 commented on Oct 14, 2021

    @shikhar13012001
    Contributor

    @Amoghtech sir please could you add hacktoberfest-accepted label as well to my PR :) that would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions