react-svg-worldmap
Advanced tools
Comparing version 1.0.36 to 1.0.37
@@ -59,2 +59,10 @@ # CHANGELOG | ||
* Added localization ability and tooltip text customization through a callback function called tooltipTextFunction | ||
* Added example of how to use to examples | ||
* Added example of how to use to examples | ||
## 1.0.36 | ||
* README.md typo | ||
## 1.0.37 | ||
* Onclick callback as requested, for instructions on usage see README.md, for an example look at the example folder under onclick-example. |
@@ -26,2 +26,3 @@ import React from "react"; | ||
styleFunction?: (context: ICountryContext) => {}; | ||
onClickFunction?: (event: React.MouseEvent<SVGElement, MouseEvent>, countryName: string, isoCode: string, value: string, prefix: string, suffix: string) => {}; | ||
tooltipTextFunction?: (countryName: string, isoCode: string, value: string, prefix: string, suffix: string) => string; | ||
@@ -28,0 +29,0 @@ borderColor?: string; |
{ | ||
"name": "react-svg-worldmap", | ||
"version": "1.0.36", | ||
"version": "1.0.37", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "displayName": "React Worldmap", |
@@ -109,2 +109,21 @@ # react-svg-worldmap [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://img.shields.io/npm/v/react-svg-worldmap.svg?style=flat)](https://www.npmjs.com/package/react-svg-worldmap) [![Demo: Simple Example](https://img.shields.io/badge/demo-live-red.svg)](https://react-svg-worldmap-simple-example.imfast.io) | ||
### On Click Action | ||
This is an optional more advanced customization option. When used, the developer has full access to the click event, country name, iso code, value, prefix and suffix is given. | ||
This is done by passing your custom implementation of the `onClickFunction`. The function takes in the following parameters: | ||
`1. event: React.MouseEvent<SVGElement, MouseEvent>` | ||
`2. countryName: string` | ||
`3. isoCode: string` | ||
`4. value: string` | ||
`5. prefix?: string` | ||
`6. suffix?: string` | ||
For example: | ||
~~~tsx | ||
const clickAction = (event: React.MouseEvent<SVGElement, MouseEvent>, countryName: string, isoCode: string, value: string, prefix?: string, suffix?: string) => { | ||
//Your action on click that you want to perform see example in the examples folder called onclick-example | ||
} | ||
~~~ | ||
### Optional Props | ||
@@ -111,0 +130,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
185528
40
180