mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
settings: convert SettingsButton to function
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user