feat(in-264): fixes

pull/83/head
Ruslan Khayrullin 3 years ago
parent f3f422c70b
commit 174ea0036d
  1. 44
      src/features/MatchSidePlaylists/components/EventButton/index.tsx
  2. 1
      src/features/MatchSidePlaylists/components/PlayersPlaylists/styled.tsx
  3. 3
      src/features/MatchSidePlaylists/components/PlayersTable/Cell.tsx
  4. 16
      src/features/MatchSidePlaylists/components/PlayersTable/styled.tsx
  5. 8
      src/features/MatchSidePlaylists/components/TabEvents/styled.tsx
  6. 8
      src/features/MatchSidePlaylists/components/TabStats/styled.tsx
  7. 1
      src/hooks/useTooltip.tsx

@ -1,11 +1,18 @@
import { ProfileTypes } from 'config' import { createPortal } from 'react-dom'
import { isMobileDevice, ProfileTypes } from 'config'
import type { Event, Team } from 'requests' import type { Event, Team } from 'requests'
import { usePageParams } from 'hooks/usePageParams' import {
useTooltip,
usePageParams,
useModalRoot,
} from 'hooks'
import { Name } from 'features/Name' import { Name } from 'features/Name'
import { T9n } from 'features/T9n' import { T9n } from 'features/T9n'
import { useLexicsStore } from 'features/LexicsStore'
import { import {
Avatar, Avatar,
@ -16,8 +23,8 @@ import {
SubTitle, SubTitle,
EventTime, EventTime,
EventLike, EventLike,
PlayerNum,
} from '../TabEvents/styled' } from '../TabEvents/styled'
import { Tooltip } from '../TabStats/styled'
type Props = { type Props = {
active?: boolean, active?: boolean,
@ -37,6 +44,16 @@ export const EventButton = ({
team, team,
}: Props) => { }: Props) => {
const { sportType } = usePageParams() const { sportType } = usePageParams()
const {
isTooltipShown,
onMouseLeave,
onMouseOver,
tooltipStyle,
tooltipText,
} = useTooltip()
const modalRoot = useModalRoot()
const { suffix } = useLexicsStore()
const { const {
c: clearTime, c: clearTime,
l: lexica, l: lexica,
@ -82,16 +99,25 @@ export const EventButton = ({
<T9n t={lexica} /> <T9n t={lexica} />
{(score1 || score2) && ` (${score1}-${score2})`} {(score1 || score2) && ` (${score1}-${score2})`}
</Title> </Title>
<SubTitle> <SubTitle
{nameObj && 'num' in nameObj && ( onMouseOver={isMobileDevice ? undefined : onMouseOver({
<PlayerNum> horizontalPosition: 'right',
{(nameObj as Event['pl'])!.num} indent: 15,
</PlayerNum> tooltipText: nameObj?.[`name_${suffix}`] || '',
)}{' '} })}
onMouseLeave={isMobileDevice ? undefined : onMouseLeave}
>
{playerName?.num}{' '}
{(playerId || teamId) && nameObj && <Name nameObj={nameObj} />} {(playerId || teamId) && nameObj && <Name nameObj={nameObj} />}
</SubTitle> </SubTitle>
</EventDesc> </EventDesc>
</EventInfo> </EventInfo>
{isTooltipShown && modalRoot.current && createPortal(
<Tooltip style={tooltipStyle}>
{tooltipText}
</Tooltip>,
modalRoot.current,
)}
</Button> </Button>
) )
} }

@ -79,6 +79,7 @@ export const PlayerNum = styled.span`
export const PlayButton = styled(PlayButtonBase)` export const PlayButton = styled(PlayButtonBase)`
justify-content: initial; justify-content: initial;
padding-right: 10px;
${Duration} { ${Duration} {
margin-left: auto; margin-left: auto;

@ -10,7 +10,8 @@ import {
useTooltip, useTooltip,
} from 'hooks' } from 'hooks'
import { Tooltip, CellContainer } from './styled' import { Tooltip } from '../TabStats/styled'
import { CellContainer } from './styled'
type CellProps = { type CellProps = {
anchorId?: string, anchorId?: string,

@ -5,7 +5,6 @@ import styled, { css } from 'styled-components/macro'
import { isIOS, isMobileDevice } from 'config' import { isIOS, isMobileDevice } from 'config'
import { customScrollbar } from 'features/Common' import { customScrollbar } from 'features/Common'
import { TooltipWrapper } from 'features/Tooltip'
import { import {
ArrowButton as ArrowButtonBase, ArrowButton as ArrowButtonBase,
Arrow as ArrowBase, Arrow as ArrowBase,
@ -76,21 +75,6 @@ export const Table = styled.table`
table-layout: fixed; table-layout: fixed;
` `
export const Tooltip = styled(TooltipWrapper)`
display: block;
padding: 2px 10px;
border-radius: 6px;
transform: none;
font-size: 11px;
line-height: 1;
color: ${({ theme }) => theme.colors.black};
z-index: 999;
::before {
display: none;
}
`
type ParamShortTitleProps = { type ParamShortTitleProps = {
showLeftArrow?: boolean, showLeftArrow?: boolean,
sortDirection: 'asc' | 'desc', sortDirection: 'asc' | 'desc',

@ -121,12 +121,10 @@ export const SubTitle = styled(Title)`
margin-top: 2px; margin-top: 2px;
${NameStyled} { ${NameStyled} {
font-weight: 600; font-weight: 700;
} }
` `
export const PlayerNum = styled.span``
export const EventLike = styled.img` export const EventLike = styled.img`
position: absolute; position: absolute;
left: -14px; left: -14px;
@ -219,10 +217,6 @@ export const Button = styled(ButtonBase) <ButtonProps>`
` : '' ` : ''
)} )}
&:hover ${EventDesc} {
overflow: visible;
}
${({ isHomeTeam }) => ( ${({ isHomeTeam }) => (
isHomeTeam isHomeTeam
? css`padding-left: 60px;` ? css`padding-left: 60px;`

@ -16,14 +16,16 @@ export const TabList = styled.div.attrs({ role: 'tablist' })`
` `
export const Tooltip = styled(TooltipWrapper)` export const Tooltip = styled(TooltipWrapper)`
display: block; display: flex;
padding: 2px 10px; justify-content: center;
align-items: center;
height: 17px;
padding: 0 10px;
border-radius: 6px; border-radius: 6px;
transform: none; transform: none;
font-size: 11px; font-size: 11px;
line-height: 1; line-height: 1;
color: ${({ theme }) => theme.colors.black}; color: ${({ theme }) => theme.colors.black};
z-index: 999;
::before { ::before {
display: none; display: none;

@ -56,6 +56,7 @@ export const useTooltip = () => {
position: 'fixed', position: 'fixed',
right: !isUndefined(coords.right) ? `${window.screen.width - coords.right}px` : 'auto', right: !isUndefined(coords.right) ? `${window.screen.width - coords.right}px` : 'auto',
top: `${coords.top}px`, top: `${coords.top}px`,
zIndex: 999,
...(horizontalPosition === 'center' && { transform: 'translateX: (-50%)' }), ...(horizontalPosition === 'center' && { transform: 'translateX: (-50%)' }),
...(verticalPosition === 'top' && { transform: 'translateY: (-50%)' }), ...(verticalPosition === 'top' && { transform: 'translateY: (-50%)' }),

Loading…
Cancel
Save