Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show districts name, population & other relevant information on popup when hovered upon district #30

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mrsudarshanrai
Copy link

Added feature issued here.
Added some more data about district like district Area, Population & Elevation. This data will be visible upon mouse hover on districts.

@vercel
Copy link

vercel bot commented Feb 17, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/aabishkaryal/nepal-districts/9sCwG2qJbR71EhmYdhPGLkqqYaok
✅ Preview: https://nepal-districts-git-fork-mrsudarshanrai-main-aabishkaryal.vercel.app

Comment on lines 16 to 17
const Modal = (props: props) => {
const { pageY, pageX, id } = props || {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default function Modal({pageX, pageY, id}) { .... }

Comment on lines 20 to 35
const districtDetails: districtDetails[] = [
{
label: "Elevation",
value: district?.elevation
},
{
label: "Area",
value: `${district?.area.toLocaleString('en-Us')} km²`
},
{
label: "Province",
value: district?.province
},
{
label: "Population",
value: district?.population
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, elevation area, province and populations are always present on the data, optional chaining isn't required

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I had this for previous version and forgot to remove

left: pageX,
}} className="max-w-md w-56 absolute py-2 px-4 bg-white shadow-lg rounded-lg ">
<header>
<h1 className="font-bold text-gray-800 ">{district?.name}</h1>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary optional chaining

<main className="mt-1">
{
districtDetails.map((district: any, index: number) => (
<p key={index}><span className="font-semibold">{district.label}</span>: {district?.value}</p>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary optional chaining

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aabishkaryal I have done changes according to your feedback. You can review now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants