Skip to content
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

Merged
merged 1 commit into from
Jan 15, 2021
Merged

Add AttributionControl #1295

merged 1 commit into from
Jan 15, 2021

Conversation

Pessimistress
Copy link
Collaborator

customAttribution: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])
});

const defaultProps = Object.assign({}, mapControlDefaultProps, {
Copy link
Collaborator

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}>
Copy link
Collaborator

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

Copy link
Collaborator Author

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)

Copy link
Collaborator Author

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' : ''} ${
Copy link
Collaborator

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

@Pessimistress Pessimistress merged commit 4cc662d into master Jan 15, 2021
@Pessimistress Pessimistress deleted the x/attribution-control branch January 15, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants