fix(ui): fix button focusing and nocontent icon size
This commit is contained in:
parent
50f82c2fd9
commit
a0a09f293e
5 changed files with 86 additions and 59 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"tabWidth": 4,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"printWidth": 150,
|
||||
"printWidth": 100,
|
||||
"singleQuote": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ function DashboardList() {
|
|||
show={lenth === 0}
|
||||
title={
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<Icon name="no-dashboard" size={170} color="figmaColors-accent-secondary" />
|
||||
<div className="mt-6 text-xl">You haven't created any dashboards yet</div>
|
||||
<Icon name="no-dashboard" size={80} color="figmaColors-accent-secondary" />
|
||||
<div className="mt-3 text-xl">You haven't created any dashboards yet</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ function MetricsList({ siteId }: { siteId: string }) {
|
|||
show={lenth === 0}
|
||||
title={
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<Icon name="no-metrics" size={170} color="figmaColors-accent-secondary" />
|
||||
<div className="mt-6 text-xl">You haven't created any metrics yet</div>
|
||||
<Icon name="no-metrics" size={80} color="figmaColors-accent-secondary" />
|
||||
<div className="mt-3 text-xl">You haven't created any metrics yet</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
selectStorageListNow,
|
||||
} from 'Player/store';
|
||||
import LiveTag from 'Shared/LiveTag';
|
||||
import { session as sessionRoute, withSiteId } from 'App/routes';
|
||||
import {
|
||||
toggleTimetravel,
|
||||
jumpToLive,
|
||||
|
|
@ -31,7 +30,7 @@ import {
|
|||
EXCEPTIONS,
|
||||
INSPECTOR,
|
||||
} from 'Duck/components/player';
|
||||
import { ReduxTime, AssistDuration } from './Time';
|
||||
import { AssistDuration } from './Time';
|
||||
import Timeline from './Timeline';
|
||||
import ControlButton from './ControlButton';
|
||||
import PlayerControls from './components/PlayerControls'
|
||||
|
|
@ -121,7 +120,6 @@ function getStorageName(type) {
|
|||
toggleBottomBlock,
|
||||
})
|
||||
export default class Controls extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
document.addEventListener('keydown', this.onKeyDown);
|
||||
}
|
||||
|
|
@ -318,6 +316,7 @@ export default class Controls extends React.Component {
|
|||
toggleSkip={toggleSkip}
|
||||
playButton={this.renderPlayBtn()}
|
||||
controlIcon={this.controlIcon}
|
||||
ref={this.speedRef}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react'
|
||||
import React from 'react';
|
||||
import { Tooltip } from 'react-tippy';
|
||||
import { ReduxTime } from '../Time';
|
||||
import { Icon } from 'UI';
|
||||
import cn from 'classnames';
|
||||
// @ts-ignore
|
||||
import styles from '../controls.module.css'
|
||||
import styles from '../controls.module.css';
|
||||
|
||||
interface Props {
|
||||
live: boolean;
|
||||
|
|
@ -16,22 +16,51 @@ interface Props {
|
|||
forthTenSeconds: () => void;
|
||||
toggleSpeed: () => void;
|
||||
toggleSkip: () => void;
|
||||
controlIcon: (icon: string, size: number, action: () => void, isBackwards: boolean, additionalClasses: string) => JSX.Element;
|
||||
controlIcon: (
|
||||
icon: string,
|
||||
size: number,
|
||||
action: () => void,
|
||||
isBackwards: boolean,
|
||||
additionalClasses: string
|
||||
) => JSX.Element;
|
||||
}
|
||||
|
||||
function PlayerControls(props: Props) {
|
||||
const {
|
||||
live,
|
||||
skip,
|
||||
speed,
|
||||
disabled,
|
||||
playButton,
|
||||
backTenSeconds,
|
||||
forthTenSeconds,
|
||||
toggleSpeed,
|
||||
toggleSkip,
|
||||
controlIcon
|
||||
const {
|
||||
live,
|
||||
skip,
|
||||
speed,
|
||||
disabled,
|
||||
playButton,
|
||||
backTenSeconds,
|
||||
forthTenSeconds,
|
||||
toggleSpeed,
|
||||
toggleSkip,
|
||||
controlIcon,
|
||||
} = props;
|
||||
|
||||
const speedRef = React.useRef(null);
|
||||
const arrowBackRef = React.useRef(null);
|
||||
const arrowForwardRef = React.useRef(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
const handleKeyboard = (e: KeyboardEvent) => {
|
||||
if (e.key === 'ArrowRight') {
|
||||
arrowForwardRef.current.focus();
|
||||
}
|
||||
if (e.key === 'ArrowLeft') {
|
||||
arrowBackRef.current.focus();
|
||||
}
|
||||
if (e.key === 'ArrowDown') {
|
||||
speedRef.current.focus();
|
||||
}
|
||||
if (e.key === 'ArrowUp') {
|
||||
speedRef.current.focus();
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', handleKeyboard);
|
||||
return () => document.removeEventListener('keydown', handleKeyboard);
|
||||
}, [speedRef, arrowBackRef, arrowForwardRef]);
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
{playButton}
|
||||
|
|
@ -47,46 +76,41 @@ function PlayerControls(props: Props) {
|
|||
|
||||
<div className="rounded ml-4 bg-active-blue border border-active-blue-border flex items-stretch">
|
||||
{/* @ts-ignore */}
|
||||
<Tooltip
|
||||
title='Rewind 10s'
|
||||
delay={0}
|
||||
position="top"
|
||||
>
|
||||
{controlIcon(
|
||||
"skip-forward-fill",
|
||||
18,
|
||||
backTenSeconds,
|
||||
true,
|
||||
'hover:bg-active-blue-border color-main h-full flex items-center'
|
||||
)}
|
||||
<Tooltip title="Rewind 10s" delay={0} position="top">
|
||||
<button ref={arrowBackRef} className="h-full focus:border focus:border-blue">
|
||||
{controlIcon(
|
||||
'skip-forward-fill',
|
||||
18,
|
||||
backTenSeconds,
|
||||
true,
|
||||
'hover:bg-active-blue-border color-main h-full flex items-center'
|
||||
)}
|
||||
</button>
|
||||
</Tooltip>
|
||||
<div className='p-1 border-l border-r bg-active-blue-border border-active-blue-border'>10s</div>
|
||||
<div className="p-1 border-l border-r bg-active-blue-border border-active-blue-border">
|
||||
10s
|
||||
</div>
|
||||
{/* @ts-ignore */}
|
||||
<Tooltip
|
||||
title='Forward 10s'
|
||||
delay={0}
|
||||
position="top"
|
||||
>
|
||||
{controlIcon(
|
||||
"skip-forward-fill",
|
||||
18,
|
||||
forthTenSeconds,
|
||||
false,
|
||||
'hover:bg-active-blue-border color-main h-full flex items-center'
|
||||
)}
|
||||
<Tooltip title="Forward 10s" delay={0} position="top">
|
||||
<button ref={arrowForwardRef} className="h-full focus:border focus:border-blue">
|
||||
{controlIcon(
|
||||
'skip-forward-fill',
|
||||
18,
|
||||
forthTenSeconds,
|
||||
false,
|
||||
'hover:bg-active-blue-border color-main h-full flex items-center'
|
||||
)}
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
{!live &&
|
||||
<div className='flex items-center mx-4'>
|
||||
{!live && (
|
||||
<div className="flex items-center mx-4">
|
||||
{/* @ts-ignore */}
|
||||
<Tooltip
|
||||
title='Playback speed'
|
||||
delay={0}
|
||||
position="top"
|
||||
>
|
||||
<Tooltip title="Control play back speed (↑↓)" delay={0} position="top">
|
||||
<button
|
||||
className={styles.speedButton}
|
||||
ref={speedRef}
|
||||
className={cn(styles.speedButton, 'focus:border focus:border-blue')}
|
||||
onClick={toggleSpeed}
|
||||
data-disabled={disabled}
|
||||
>
|
||||
|
|
@ -95,7 +119,11 @@ function PlayerControls(props: Props) {
|
|||
</Tooltip>
|
||||
|
||||
<button
|
||||
className={cn(styles.skipIntervalButton, { [styles.withCheckIcon]: skip, [styles.active]: skip }, 'ml-4')}
|
||||
className={cn(
|
||||
styles.skipIntervalButton,
|
||||
{ [styles.withCheckIcon]: skip, [styles.active]: skip },
|
||||
'ml-4'
|
||||
)}
|
||||
onClick={toggleSkip}
|
||||
data-disabled={disabled}
|
||||
>
|
||||
|
|
@ -103,9 +131,9 @@ function PlayerControls(props: Props) {
|
|||
{'Skip Inactivity'}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default PlayerControls;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue