Skip to content

Commit

Permalink
Merge pull request #41 from binary-butterfly/modernize
Browse files Browse the repository at this point in the history
Rework everything
  • Loading branch information
DysphoricUnicorn authored Dec 1, 2024
2 parents 9e19484 + f6bd724 commit c6233f9
Show file tree
Hide file tree
Showing 54 changed files with 5,646 additions and 13,667 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22
cache: 'npm'
- run: npm install
- run: npm run build:prod
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22
- run: npm install
- run: npm run prepublishOnly
- uses: JS-DevTools/npm-publish@v2
Expand Down
54 changes: 6 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,20 @@
# ReactButterflyMap

This is a small react component that contains an OpenStreetMap widget with points of interest .
This is a small react component that contains an OpenStreetMap widget with points of interest.

## Current state

This library is working as intended but still pre- 1.0 release, meaning that the API may change at any moment
or that new features might not always be entirely documented.
After not being updated for almost exactly three years, this library got almost completely rewritten to make it more adaptable,
improve its code style, DX, and make everything better.
I have not yet written documentation about the changes to how the library works, but I hope to do so soon.
Once I am done, this will be the 1.0.0 release of the library.

## How to use

* Install the package: `npm install react-butterfly-map `
* Import the main component: `import ButterflyMap from 'react-butterfly-map'`
* Include the component in you code similar to this example:
```js
<ButterflyMap
tileServer={'your.tile-server.invalid.tld/style.json'}
center={{latitude: 47.79, longitude: 13.0550}}
height={500}
pointTypes={[
{
name: 'Example 1',
icon: YourIconReactComponent,
points: [
{
position: {latitude: 47.850670, longitude: 13.090983},
address: 'Street 123, Somewhere',
text: 'This is an example',
additionalInfo: 'Examples are used to to show how something works.',
hours: {
sunday: false,
monday: [{from: ['7', '0'], until: ['22', '0']}],
tuesday: [{from: ['20', '0'], until: ['22', '0']}],
wednesday: [{from: ['7', '0'], until: ['22', '0']}],
thursday: [{from: ['7', '0'], until: ['22', '0']}],
friday: [{from: ['7', '0'], until: ['22', '0']}],
saturday: false,
},
valid: {
from: '2021-01-01',
until: '2038-01-01',
}
},
],
},
]}
/>
```

### Searching

There is some (currently untested) search functionality available.
To use this, you must set up a server that responds to a JSON call containing the key `searchString` with an array
of position objects containing the keys `text`, `latitude` and `longitude`.

Once you've done that, simply set the `searchBackend` param of `<ButterflyMap/>` to the URL of your backend.

This feature is still in early development and the API may change.
Due to the cost associated with Geocoding, there is no search backend available for testing at this time.
TODO: Write docs for this. But not in the middle of the night on a sunday.

## Development

Expand Down
13 changes: 0 additions & 13 deletions assets/img/exampleCombinationMarker.svg

This file was deleted.

13 changes: 0 additions & 13 deletions assets/img/exampleMarker1.svg

This file was deleted.

13 changes: 0 additions & 13 deletions assets/img/exampleMarker2.svg

This file was deleted.

13 changes: 0 additions & 13 deletions assets/img/specialExampleMarker.svg

This file was deleted.

Loading

0 comments on commit c6233f9

Please sign in to comment.