Placing a component at the location of a click on another component - reactjs

I am displaying pages of a PDF using react-pdf in my application. I have a button called 'add marking', which when clicked, should give the ability to add a mark (small circle component) on the PDF page at the location where I click.
I'm confused with how I should be approaching the problem. I am particularly stuck with what is the best way to get the x and y coordiantes of the click on the pdf. I want the mark to be the same wrt the pdf at all times.

Related

Save for later animation like instagram in react.js

I have a bookmark kind of button which saves the item to another page, and I want to animate "fly to cart" kind of animation when clicking on save with react and dont know where to start or how. The animation should fly to the icon in the navbar to show the user where it gets stored.
this is how the button looks like
enter image description here
I have not tried anything yet, so I need advise for where to start and what to do. I have seen something called spring, but dont know if it works with what I am trying to accomplish

react-router-dom - page transition animation is executed after the new page is loaded

I'm trying to implement a page transition animation that works as follows:
User clicks a link on the website
A block slides down from top to the bottom so the whole screen turns into the block's color
After a short delay, the block disappears by sliding down further
User sees a new page opened.
The libraries I use are:
React
React Router Dom
Transition Group
GSAP
You can find the current implementation here: https://codesandbox.io/s/frosty-brook-3dl6y5
The problem is that the animation gets triggered after the new page is opened (i.e. user clicks a link, sees a new page's content, and then the animation starts).
I've already tried many different things, including replacing onEnter with onExist in PageTransition component, however, nothing worked.
How can I update my code so the animation gets triggered before the new page loads?
Just in case, I'm ready to switch to any open source library that would allow me to achieve what I described above.

React two click handling

I have a coverflow in my program that select an image on click, but I need to have functionality that when you click on the chosen image a second time, it links you to a route.
Like with itunes, you can scrowl side by side the coverflow to chose the correct album and click again to access it's page.
The coverflow has the attribute handleSelect. I want the first click to select the image and make it bigger and in the center of the coverflow, and for the second click to follow the route.
Is it doable?
I use this coverflow: https://github.com/leon-good-life/coverflow-react
Thanks.
For the first click figure out to enlarge image ,You have to do a complete change in you css .It is easier to add the enlargement when hovered, because that makes more sense ,Anyway add counts to the onClick function you are using and then do the complete routing in that function when the clickcCount exedes you limit..

React, dynamic ANTD tabs and router

I'm new to reactJS, get confused when trying to create dynamic (antd) tab.
Basically, i have two layers in Application, the first one is Sidemenu Bar, located on left of the screen, and the second layer is content pages, which represented with Tabs.
The Sidemenu has some variable numbers of menu buttons (modules). When each button are pressed, then React will render that module (each module represent by individual JSfile) to the content layer, inside a new Tab panel. The module page itself, can be duplicated on the Tab.
To do that I created a sidemenu.js which contain a menu buttons (and its corresponding URL), and appPages.js to hold that Tabs that will render the specific module(s).
How to make it possible ? where I should write the routes (react-router-dom) ?
I search for this topic, and found it solved using the same js file, not the separated file or component.
Please check my sandbox here : https://codesandbox.io/s/dynamictabs-83mop
Thank you. Really appreciated for any help, and so sorry about my english.

Angularjs get id cross html files

I have divided the whole page(post.html) into two pages. The right one shows google map(with search box) and the left one I use to make the post_side.html page showing up.
Inside the post_side.html, I use to make some other pages shows up by nested states.
The problem is that I cannot get the input id(the search box in post_side.html or even some other files) to control the map(shows in post.html) without trigger(no button click).
If it is possible to make this happen?

Resources