diff --git a/web/navigation-sidebar/account-settings-button.css b/web/navigation-sidebar/account-settings-button.css new file mode 100644 --- /dev/null +++ b/web/navigation-sidebar/account-settings-button.css @@ -0,0 +1,14 @@ +.container { + display: flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + border-radius: 50%; + color: var(--button-label-primary-default); + background-color: var(--button-background-primary-default); +} + +.container:hover { + cursor: pointer; +} diff --git a/web/navigation-sidebar/account-settings-button.react.js b/web/navigation-sidebar/account-settings-button.react.js new file mode 100644 --- /dev/null +++ b/web/navigation-sidebar/account-settings-button.react.js @@ -0,0 +1,43 @@ +// @flow + +import * as React from 'react'; + +import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; + +import css from './account-settings-button.css'; +import { updateNavInfoActionType } from '../redux/action-types.js'; +import { useNavigationSidebarTooltip } from '../utils/tooltip-action-utils.js'; + +function AccountSettingsButton(): React.Node { + const dispatch = useDispatch(); + + const openAccountSettings = React.useCallback( + () => + dispatch({ + type: updateNavInfoActionType, + payload: { + tab: 'settings', + settingsSection: 'account', + }, + }), + [dispatch], + ); + + const { onMouseEnter, onMouseLeave } = useNavigationSidebarTooltip({ + tooltipLabel: 'Settings', + }); + + return ( +