-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v8] Align type names across modules (#2468)
- Loading branch information
1 parent
2785a32
commit 4f856f0
Showing
33 changed files
with
661 additions
and
1,241 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
22 changes: 9 additions & 13 deletions
22
modules/main/src/mapbox-legacy/components/attribution-control.ts
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,32 +1,28 @@ | ||
import * as React from 'react'; | ||
import {useEffect, memo} from 'react'; | ||
import {applyReactStyle} from '../utils/apply-react-style'; | ||
import useControl from './use-control'; | ||
import {useControl} from './use-control'; | ||
|
||
import type {ControlPosition, AttributionControlInstance} from '../types'; | ||
import type {ControlPosition, AttributionControlOptions} from '../types/lib'; | ||
|
||
export type AttributionControlProps<OptionsT> = OptionsT & { | ||
export type AttributionControlProps = AttributionControlOptions & { | ||
/** Placement of the control relative to the map. */ | ||
position?: ControlPosition; | ||
/** CSS style override, applied to the control's container */ | ||
style?: React.CSSProperties; | ||
}; | ||
|
||
function AttributionControl<AttributionControlOptions, ControlT extends AttributionControlInstance>( | ||
props: AttributionControlProps<AttributionControlOptions> | ||
): null { | ||
const ctrl = useControl<ControlT>( | ||
({mapLib}) => new mapLib.AttributionControl(props) as ControlT, | ||
{ | ||
position: props.position | ||
} | ||
); | ||
function _AttributionControl(props: AttributionControlProps) { | ||
const ctrl = useControl(({mapLib}) => new mapLib.AttributionControl(props), { | ||
position: props.position | ||
}); | ||
|
||
useEffect(() => { | ||
// @ts-expect-error accessing private member | ||
applyReactStyle(ctrl._container, props.style); | ||
}, [props.style]); | ||
|
||
return null; | ||
} | ||
|
||
export default memo(AttributionControl); | ||
export const AttributionControl = memo(_AttributionControl); |
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
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
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
Oops, something went wrong.