Skip to content

Commit

Permalink
Make props non-mandatory for library components
Browse files Browse the repository at this point in the history
  • Loading branch information
tnagorra committed Nov 17, 2023
1 parent f76b31a commit ac1b304
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/src/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ type Pos = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';

interface Props {
mapStyle: MapOptions['style'];
mapOptions: Omit<MapOptions, 'style' | 'container'>;
mapOptions?: Omit<MapOptions, 'style' | 'container'>;

scaleControlShown: boolean;
scaleControlShown?: boolean;
scaleControlPosition?: Pos;
scaleControlOptions?: ConstructorParameters<typeof ScaleControl>[0];

navControlShown: boolean;
navControlShown?: boolean;
navControlPosition?: Pos;
navControlOptions?: ConstructorParameters<typeof NavigationControl>[0];

Expand Down
4 changes: 2 additions & 2 deletions lib/src/MapBounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { MapChildContext } from './context';

interface Props {
bounds: LngLatBoundsLike | undefined;
padding: number | PaddingOptions;
duration: number;
padding?: number | PaddingOptions;
duration?: number;
}

function MapBounds(props: Props) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/MapCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MapChildContext } from './context';

interface Props {
center: LngLatLike | undefined;
centerOptions: Omit<FlyToOptions, 'center'>;
centerOptions?: Omit<FlyToOptions, 'center'>;
}

function MapCenter(props: Props) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/MapPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const noop = () => {};

// TODO: add mapStyle if necessary
interface Props {
children: React.ReactElement;
children: React.ReactNode;
coordinates: LngLatLike;
hidden: boolean;
hidden?: boolean;
onHide?: () => void;
popupOptions?: PopupOptions;
trackPointer: boolean;
trackPointer?: boolean;
}

function MapPopup(props: Props) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/MapSource/MapState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const noop = () => {};
interface Props<T> {
sourceLayer?: string;
attributeKey: string;
attributes: { id: number; value: T }[];
attributes: { id: number; value: T }[] | undefined;
}

const emptyAttributes: { id: number, value: unknown }[] = [];
Expand Down
2 changes: 1 addition & 1 deletion storybook/stories/points.geo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{"id": 9, "type":"Feature","properties":{"size":21},"geometry":{"coordinates":[87.29441830807923,26.80668471032783],"type":"Point"}},
{"id": 10, "type":"Feature","properties":{"size":46},"geometry":{"coordinates":[87.28003380525138,26.660334791546035],"type":"Point"}},
{"id": 11, "type":"Feature","properties":{"size":20},"geometry":{"coordinates":[87.70722604502095,26.663100830545687],"type":"Point"}},
{"id": 12, "type":"Feature","properties":{"size":12},"geometry":{"coordinates":[87.98846811924068,26.64392958269093],"type":"Point"}},
{"id": 12, "type":"Feature","properties":{"size":42},"geometry":{"coordinates":[87.98846811924068,26.64392958269093],"type":"Point"}},
{"id": 13, "type":"Feature","properties":{"size":34},"geometry":{"coordinates":[85.91531900080656,26.72792517109815],"type":"Point"}},
{"id": 14, "type":"Feature","properties":{"size":67},"geometry":{"coordinates":[85.03372409474434,27.423451458413965],"type":"Point"}},
{"id": 15, "type":"Feature","properties":{"size":88},"geometry":{"coordinates":[84.43390880617767,27.689846903500538],"type":"Point"}},
Expand Down

0 comments on commit ac1b304

Please sign in to comment.