From 8c093cc0d2fe6657aa11eb6dd35787349d3db9db Mon Sep 17 00:00:00 2001 From: Ruslan Khayrullin Date: Wed, 19 Aug 2020 13:04:43 +0300 Subject: [PATCH] feat(ott-297): tournament matches (#88) --- src/features/PlayerPage/hooks.tsx | 1 - src/features/PlayerPage/index.tsx | 17 ++++++----------- src/features/ProfileCard/hooks.tsx | 8 +++----- src/features/ProfileCard/styled.tsx | 2 ++ src/features/ProfileCard/types.tsx | 3 +-- src/features/TournamentPage/hooks.tsx | 1 - src/features/TournamentPage/index.tsx | 12 ++++++------ src/features/TournamentPage/styled.tsx | 5 +++++ 8 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 src/features/TournamentPage/styled.tsx diff --git a/src/features/PlayerPage/hooks.tsx b/src/features/PlayerPage/hooks.tsx index 5ec36ee5..16233ab1 100644 --- a/src/features/PlayerPage/hooks.tsx +++ b/src/features/PlayerPage/hooks.tsx @@ -39,6 +39,5 @@ export const usePlayerPage = () => { return { infoItems, name: fullName, - sportType, } } diff --git a/src/features/PlayerPage/index.tsx b/src/features/PlayerPage/index.tsx index 174ef24d..7b509b49 100644 --- a/src/features/PlayerPage/index.tsx +++ b/src/features/PlayerPage/index.tsx @@ -1,7 +1,6 @@ import React from 'react' import { ProfileTypes } from 'config' -import { MainWrapper } from 'features/MainWrapper' import { UserFavorites } from 'features/UserFavorites' import { ProfileCard } from 'features/ProfileCard' import { UserFavoritesStore } from 'features/UserFavorites/store' @@ -12,20 +11,16 @@ export const PlayerPage = () => { const { infoItems, name, - sportType, } = usePlayerPage() return ( - - - - + + ) } diff --git a/src/features/ProfileCard/hooks.tsx b/src/features/ProfileCard/hooks.tsx index 1d3b0ae2..8c34df5f 100644 --- a/src/features/ProfileCard/hooks.tsx +++ b/src/features/ProfileCard/hooks.tsx @@ -5,16 +5,14 @@ import findIndex from 'lodash/findIndex' import { handleImageError, getProfileLogo } from 'helpers' import { useUserFavoritesStore } from 'features/UserFavorites/store' -import { usePageId } from 'hooks' +import { useSportNameParam, usePageId } from 'hooks' import type { ProfileCardProps } from './types' -export const useProfileCard = ({ - profileType, - sportType, -}: ProfileCardProps) => { +export const useProfileCard = ({ profileType }: ProfileCardProps) => { const { addRemoveFavorite, userFavorites } = useUserFavoritesStore() const profileId = usePageId() + const { sportType } = useSportNameParam() const isFavorite = findIndex(userFavorites, { id: profileId, diff --git a/src/features/ProfileCard/styled.tsx b/src/features/ProfileCard/styled.tsx index 079b3210..3be8c045 100644 --- a/src/features/ProfileCard/styled.tsx +++ b/src/features/ProfileCard/styled.tsx @@ -4,6 +4,8 @@ import { ProfileTypes } from 'config' export const Wrapper = styled.div` display: flex; + margin-left: 70px; + margin-bottom: 50px; ` export const Name = styled.h1` diff --git a/src/features/ProfileCard/types.tsx b/src/features/ProfileCard/types.tsx index c2f8786c..b4912077 100644 --- a/src/features/ProfileCard/types.tsx +++ b/src/features/ProfileCard/types.tsx @@ -1,8 +1,7 @@ -import { ProfileTypes, SportTypes } from 'config' +import { ProfileTypes } from 'config' export type ProfileCardProps = { infoItems: Array, name: string, profileType: ProfileTypes, - sportType: SportTypes, } diff --git a/src/features/TournamentPage/hooks.tsx b/src/features/TournamentPage/hooks.tsx index 97fb3a83..67f4384c 100644 --- a/src/features/TournamentPage/hooks.tsx +++ b/src/features/TournamentPage/hooks.tsx @@ -41,6 +41,5 @@ export const useTournamentPage = () => { return { infoItems: [country], name, - sportType, } } diff --git a/src/features/TournamentPage/index.tsx b/src/features/TournamentPage/index.tsx index 572a935b..d4b82c22 100644 --- a/src/features/TournamentPage/index.tsx +++ b/src/features/TournamentPage/index.tsx @@ -2,31 +2,31 @@ import React from 'react' import { ProfileTypes } from 'config' -import { MainWrapper } from 'features/MainWrapper' import { UserFavorites } from 'features/UserFavorites' import { ProfileCard } from 'features/ProfileCard' +import { Matches } from 'features/Matches' import { UserFavoritesStore } from 'features/UserFavorites/store' import { useTournamentPage } from './hooks' +import { Content } from './styled' export const TournamentPage = () => { const { infoItems, name, - sportType, } = useTournamentPage() return ( - - + + - + + ) } diff --git a/src/features/TournamentPage/styled.tsx b/src/features/TournamentPage/styled.tsx new file mode 100644 index 00000000..fcd79930 --- /dev/null +++ b/src/features/TournamentPage/styled.tsx @@ -0,0 +1,5 @@ +import styled from 'styled-components/macro' + +export const Content = styled.main` + padding: 0 16px; +`