Skip to content

Commit

Permalink
feat: improve example and add description
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHoing committed Aug 29, 2023
1 parent 1b65998 commit 81aaf6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function BackgroundChooserExample() {
<ComponentToUseTheMap />
<BackgroundLayerChooser
layers={layers}
allowEmptyBackground={true}
/>
</MapContext.Provider>
);
Expand Down
16 changes: 14 additions & 2 deletions src/BackgroundLayerChooser/BackgroundLayerChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,21 @@ import SimpleButton from '../Button/SimpleButton/SimpleButton';
import './BackgroundLayerChooser.less';

export type BackgroundLayerChooserProps = {
/**
* Array of layers to be displayed in the BackgroundLayerChooser.
*/
layers: OlLayer[];
/**
* Adds a button that clears the backgroundlayer.
*/
allowEmptyBackground?: boolean;
/**
* Customize the tooltip.
*/
buttonTooltip?: string;
/**
* Filters the backgroundlayers by a function.
*/
backgroundLayerFilter?: (layer: OlLayerBase) => boolean;
};

Expand Down Expand Up @@ -177,12 +189,12 @@ export const BackgroundLayerChooser: React.FC<BackgroundLayerChooserProps> = ({
/>
<div className="bg-preview">
<div className='overview-wrapper'>
{!isBackgroundImage?
{!isBackgroundImage ?
<div id="overview-map" ref={mapTarget}
/> :
<FontAwesomeIcon className='no-background-preview' icon={faBan} size='5x' />
}
{ selectedLayer ?
{selectedLayer ?
<span className="layer-title">{selectedLayer.get('name')}</span> :
<span className="layer-title-no-background">No Background</span>
}
Expand Down

0 comments on commit 81aaf6e

Please sign in to comment.