-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AttributionControl #1295
Add AttributionControl #1295
Conversation
customAttribution: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]) | ||
}); | ||
|
||
const defaultProps = Object.assign({}, mapControlDefaultProps, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you feel about destructuring here:
const defaultProps ={...mapControlDefaultProps, {
className: '',
toggleLabel: 'Toggle Attribution'
}};
const toggleAttribution = useCallback(() => setShowCompact(value => !value), []); | ||
|
||
return ( | ||
<div style={{position: 'absolute', ...props.style}} className={props.className}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take advantage of useMemo the same way you did in other PRs
useMemo(() => ({position: 'absolute', ...(props.style || {})}), [props.style])
I would make sure prop.style is not null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the spread operator supports null/undefined (similar to Object.assign
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address in #1297
<div | ||
ref={containerRef} | ||
aria-pressed={showCompact} | ||
className={`mapboxgl-ctrl mapboxgl-ctrl-attrib ${compact ? 'mapboxgl-compact' : ''} ${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are planning on having several instances of class name manipulation we should think about using something like classnames
to better handle these cases
#1129