mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
use consistent tooltip delay
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
import { Action } from 'redux';
|
||||
import { SettingId } from '../settings';
|
||||
import { SettingId } from '../settings/user';
|
||||
|
||||
/** Actions related to settings. */
|
||||
export enum SettingsActionType {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import { WithI18nProps, withI18n } from '@shopify/react-i18n';
|
||||
import React from 'react';
|
||||
import { tooltipDelay } from '../settings/ui';
|
||||
import { TooltipId } from './button-i18n';
|
||||
import en from './button-i18n.en.json';
|
||||
|
||||
@@ -42,7 +43,11 @@ class ActionButton extends React.Component<Props> {
|
||||
tooltipText += ` (${this.props.keyboardShortcut})`;
|
||||
}
|
||||
return (
|
||||
<Tooltip content={tooltipText} position={Position.BOTTOM}>
|
||||
<Tooltip
|
||||
content={tooltipText}
|
||||
position={Position.BOTTOM}
|
||||
hoverOpenDelay={tooltipDelay}
|
||||
>
|
||||
<Button
|
||||
ref={this.buttonRef}
|
||||
intent={Intent.PRIMARY}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Button, Intent, Position, Tooltip } from '@blueprintjs/core';
|
||||
import { WithI18nProps, withI18n } from '@shopify/react-i18n';
|
||||
import React from 'react';
|
||||
import { tooltipDelay } from '../settings/ui';
|
||||
import { TooltipId } from './button-i18n';
|
||||
import en from './button-i18n.en.json';
|
||||
|
||||
@@ -28,6 +29,7 @@ class LinkButton extends React.Component<Props> {
|
||||
<Tooltip
|
||||
content={this.props.i18n.translate(this.props.tooltip)}
|
||||
position={Position.BOTTOM}
|
||||
hoverOpenDelay={tooltipDelay}
|
||||
>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Button, Intent, Position, Tooltip } from '@blueprintjs/core';
|
||||
import { WithI18nProps, withI18n } from '@shopify/react-i18n';
|
||||
import React from 'react';
|
||||
import Dropzone, { FileRejection } from 'react-dropzone';
|
||||
import { tooltipDelay } from '../settings/ui';
|
||||
import { TooltipId } from './button-i18n';
|
||||
import en from './button-i18n.en.json';
|
||||
|
||||
@@ -81,6 +82,7 @@ class OpenFileButton extends React.Component<Props> {
|
||||
<Tooltip
|
||||
content={this.props.i18n.translate(this.props.tooltip)}
|
||||
position={Position.BOTTOM}
|
||||
hoverOpenDelay={tooltipDelay}
|
||||
>
|
||||
<Button
|
||||
{...getRootProps()}
|
||||
|
||||
@@ -9,15 +9,14 @@ import { Action, Dispatch } from '../actions';
|
||||
import { closeSettings } from '../actions/app';
|
||||
import { setBoolean } from '../actions/settings';
|
||||
import { RootState } from '../reducers';
|
||||
import { SettingId } from '../settings';
|
||||
import { tooltipDelay } from '../settings/ui';
|
||||
import { SettingId } from '../settings/user';
|
||||
import { isMacOS } from '../utils/os';
|
||||
import { SettingsStringId } from './settings-i18n';
|
||||
import en from './settings-i18n.en.json';
|
||||
|
||||
import './settings.scss';
|
||||
|
||||
const tooltipDelay = 1000;
|
||||
|
||||
type StateProps = {
|
||||
open: boolean;
|
||||
showDocs: boolean;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Reducer, combineReducers } from 'redux';
|
||||
import { Action } from '../actions';
|
||||
import { SettingsActionType } from '../actions/settings';
|
||||
import { SettingId, getDefaultBooleanValue } from '../settings';
|
||||
import { SettingId, getDefaultBooleanValue } from '../settings/user';
|
||||
|
||||
export interface SettingsState {
|
||||
readonly darkMode: boolean;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { AsyncSaga } from '../../test';
|
||||
import { startup } from '../actions/app';
|
||||
import { didBooleanChange, didFailToSetBoolean, setBoolean } from '../actions/settings';
|
||||
import { SettingsState } from '../reducers/settings';
|
||||
import { SettingId } from '../settings';
|
||||
import { SettingId } from '../settings/user';
|
||||
import settings from './settings';
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
didFailToSetBoolean,
|
||||
} from '../actions/settings';
|
||||
import { RootState } from '../reducers';
|
||||
import { SettingId, getDefaultBooleanValue } from '../settings';
|
||||
import { SettingId, getDefaultBooleanValue } from '../settings/user';
|
||||
|
||||
function stringToBoolean(value: string): boolean {
|
||||
return value.toLowerCase().match(/(true|yes|1)/) !== null;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
// Definitions for compile-time UI settings.
|
||||
|
||||
/** Time in milliseconds before showing tooltip popover. */
|
||||
export const tooltipDelay = 1000;
|
||||
@@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
import { prefersDarkMode } from '../utils/os';
|
||||
// Definitions for user selectable settings.
|
||||
|
||||
// Definitions for user settings.
|
||||
import { prefersDarkMode } from '../utils/os';
|
||||
|
||||
export enum SettingId {
|
||||
ShowDocs = 'showDocs',
|
||||
Reference in New Issue
Block a user