usecannon / cannon

Manage EVM protocol deployments. Inspired by Docker, Terraform, and npm.
https://usecannon.com
GNU General Public License v3.0
104 stars 21 forks source link

feat(website): CAN-425 prevent page reload when selecting a new method on interact. #1240

Closed nicosampler closed 3 months ago

nicosampler commented 3 months ago

This PR prevents doing a page reload when a new method is selected in the interact section.

Every method was a <Nextjs/Link> component, when the user clicked it a page reload was triggered by concatenating a # to the URL and adding the method selector.

In this PR, the Link was replaced with a button and the onclick event updates the URL in shallow mode. Also, the positioning of the scroll to visualize the method selected was calculated by hand. There was an issue when more than one method box was opened, as the logic didn't consider the height of the opened elements. Now a lib called `react-scroll was added to handle this behavior.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: bcb5f06fc58e2b0bba00979337020ddd0f32d3eb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

nx-cloud[bot] commented 3 months ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit bcb5f06fc58e2b0bba00979337020ddd0f32d3eb. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target - [`lerna run build --ignore cannon-website --ignore @usecannon/indexer --ignore repo --ignore @usecannon/api`](https://cloud.nx.app/runs/TBohL9wLSp?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.