settings: convert SettingsButton to function

This commit is contained in:
David Lechner
2021-12-27 12:36:38 -06:00
parent a1db455a66
commit e8a3026c43
+6 -14
View File
@@ -1,23 +1,15 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
import { connect } from 'react-redux';
import React from 'react';
import ActionButton, { ActionButtonProps } from '../toolbar/ActionButton';
import { TooltipId } from '../toolbar/i18n';
import settingsIcon from './settings.svg';
type StateProps = undefined;
type DispatchProps = undefined;
type OwnProps = Pick<ActionButtonProps, 'id' | 'onAction'>;
type SettingsButtonProps = Pick<ActionButtonProps, 'id' | 'onAction'>;
const mergeProps = (
_stateProps: StateProps,
_dispatchProps: DispatchProps,
ownProps: OwnProps,
): ActionButtonProps => ({
tooltip: TooltipId.Settings,
icon: settingsIcon,
...ownProps,
});
const SettingsButton: React.FunctionComponent<SettingsButtonProps> = (props) => {
return <ActionButton tooltip={TooltipId.Settings} icon={settingsIcon} {...props} />;
};
export default connect(undefined, undefined, mergeProps)(ActionButton);
export default SettingsButton;