-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from ruralinnovation/development
rebuild api context
- Loading branch information
Showing
20 changed files
with
392 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,40 @@ | ||
import React from 'react'; | ||
interface CategoricalLegendProps { | ||
/** | ||
* This is a prototype generalization of the CategoricalLegend component used in the | ||
* [ERC tool](https://github.com/ruralinnovation/erc-frontend-ts/tree/dev/MDAT-30-frontend-ui-shared-library/src/components){target=_blank} | ||
* | ||
* ```ts | ||
* import { CategoricalLegend } from '@cori-risi/cori.data.api'; | ||
* | ||
* import "@cori-risi/cori.data.api/inst/dist/cori.data.api.css"; | ||
* | ||
* // ... | ||
* | ||
* const colorScale = d3.scaleOrdinal<string>() | ||
* .domain(groups) // Input domain | ||
* .range(["#A3E2B5", "#00835D", "#26535C"]); | ||
* | ||
* const colorScaleDomain = colorScale.domain(); | ||
* const colorScaleRange = colorScale.range(); | ||
* | ||
* // ... | ||
* | ||
* <CategoricalLegend domain_names={colorScaleDomain.map(c => data.filter(d => d.geoid === c).map(d => d.name)[0])} | ||
* domain={colorScaleDomain} | ||
* range={colorScaleRange} /> | ||
* ``` | ||
* | ||
* @param props.domain_names - an (array) of names, each one mapped to a category in the color scale domain | ||
* @param props.domain - d3 color scale domain | ||
* @param props.range - d3 color scale range | ||
*/ | ||
declare function CategoricalLegend(props: { | ||
domain_names?: string[] | undefined; | ||
domain?: string[] | undefined; | ||
range?: unknown[] | undefined; | ||
scale?: any | undefined; | ||
na_message?: string; | ||
title?: string; | ||
} | ||
declare function CategoricalLegend({ domain, domain_names, range, title, scale, na_message }: CategoricalLegendProps): React.JSX.Element; | ||
na_message?: string; | ||
}): React.JSX.Element; | ||
export default CategoricalLegend; | ||
//# sourceMappingURL=CategoricalLegend.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
import { MarkerProps, ControlPosition } from 'react-map-gl'; | ||
import { GeocoderOptions } from '@mapbox/mapbox-gl-geocoder'; | ||
type GeocoderControlProps = Omit<GeocoderOptions, 'accessToken' | 'mapboxgl' | 'marker'> & { | ||
/** | ||
* This is a Geocoder search component that can be added to any `react-map-gl` Map component. | ||
* | ||
* ```ts | ||
* import mapboxgl from 'mapbox-gl'; | ||
* import Map, { Source, Layer } from 'react-map-gl'; | ||
* | ||
* import { GeocoderControl } from "@cori-risi/cori.data.api"; | ||
* | ||
* import "mapbox-gl/dist/mapbox-gl.css"; | ||
* | ||
* mapboxgl.accessToken = import.meta.env.VITE_MAPBOX_ACCESS_TOKEN; | ||
* | ||
* // ... | ||
* | ||
* <Map mapboxAccessToken={MAPBOX_TOKEN} | ||
* {...} > | ||
* <Source {...} > | ||
* <Layer {...} /> : | ||
* </Source> | ||
* <GeocoderControl mapboxAccessToken={MAPBOX_TOKEN} position="top-left" /> | ||
* </Map> | ||
* ``` | ||
* | ||
* @param props.mapboxAccessToken - Mapbox API token | ||
* @param props.marker - `true` or `false` to place marker on result once selected (default: `false`) | ||
* @param props.position - CSS class to position control in "top-left", "top-right", "bottom-left" or "bottom-right" of the map pane | ||
*/ | ||
export default function GeocoderControl(props: { | ||
mapboxAccessToken: string; | ||
marker?: boolean | Omit<MarkerProps, 'longitude' | 'latitude'>; | ||
position: ControlPosition; | ||
onLoading?: (e: object) => void; | ||
onResults?: (e: object) => void; | ||
onResult?: (e: object) => void; | ||
onError?: (e: object) => void; | ||
}; | ||
export default function GeocoderControl(props: GeocoderControlProps): null; | ||
export {}; | ||
}): null; | ||
//# sourceMappingURL=GeocoderControl.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.