feat(ott-1696): add header image on team and tournament profile (#512)

* feat(ott-1696): add header image on team and tournament profile

* feat(ott-1696): fix pr

* Update src/features/Common/Input/styled.tsx

Co-authored-by: Mirlan <m.maksitaliev@gmail.com>
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
PolyakovaM 4 years ago committed by Mirlan
parent 53e0abae2d
commit 0cc76bbec6
  1. 3
      src/features/Common/Input/index.tsx
  2. 7
      src/features/Common/Input/styled.tsx
  3. 13
      src/features/ProfileHeader/index.tsx
  4. 9
      src/features/ProfileHeader/styled.tsx
  5. 7
      src/features/Search/index.tsx
  6. 1
      src/features/TeamPage/hooks.tsx
  7. 6
      src/features/TeamPage/index.tsx
  8. 1
      src/features/TournamentPage/hooks.tsx
  9. 6
      src/features/TournamentPage/index.tsx
  10. 1
      src/requests/getTeamInfo.tsx
  11. 1
      src/requests/getTournamentInfo.tsx

@ -27,6 +27,7 @@ type Props = {
labelLexic?: string, labelLexic?: string,
labelWidth?: number, labelWidth?: number,
maxLength?: number, maxLength?: number,
noShadow?: boolean,
onBlur?: (event: FocusEvent<HTMLInputElement>) => void, onBlur?: (event: FocusEvent<HTMLInputElement>) => void,
onChange?: (event: ChangeEvent<HTMLInputElement>) => void, onChange?: (event: ChangeEvent<HTMLInputElement>) => void,
onFocus?: (event: FocusEvent<HTMLInputElement>) => void, onFocus?: (event: FocusEvent<HTMLInputElement>) => void,
@ -50,6 +51,7 @@ export const Input = ({
labelLexic, labelLexic,
labelWidth, labelWidth,
maxLength, maxLength,
noShadow,
onBlur, onBlur,
onChange, onChange,
onFocus, onFocus,
@ -70,6 +72,7 @@ export const Input = ({
wrapperWidth={wrapperWidth} wrapperWidth={wrapperWidth}
hasRightIcon={editIcon} hasRightIcon={editIcon}
error={error} error={error}
noShadow={noShadow}
> >
<Label> <Label>
<LabelTitle labelWidth={labelWidth} isUserAccountPage={isUserAccountPage}> <LabelTitle labelWidth={labelWidth} isUserAccountPage={isUserAccountPage}>

@ -9,6 +9,7 @@ import { isMobileDevice } from 'config/userAgent'
export type WrapperProps = { export type WrapperProps = {
error?: string | null, error?: string | null,
hasRightIcon?: boolean, hasRightIcon?: boolean,
noShadow?: boolean,
wrapperWidth?: number, wrapperWidth?: number,
} }
@ -23,7 +24,11 @@ export const wrapperStyles = css<WrapperProps>`
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #3F3F3F; background-color: #3F3F3F;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); box-shadow: ${({ noShadow }) => (
noShadow
? ''
: '0px 1px 1px rgba(0, 0, 0, 0.3)'
)};
border-radius: 2px; border-radius: 2px;
border: 1px solid ${(({ error }) => (isNil(error) ? 'transparent' : '#E64646'))}; border: 1px solid ${(({ error }) => (isNil(error) ? 'transparent' : '#E64646'))};
border-width: 1px; border-width: 1px;

@ -2,6 +2,8 @@ import type { ReactNode } from 'react'
import { Fragment } from 'react' import { Fragment } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import isNull from 'lodash/isNull'
import { PAGES } from 'config' import { PAGES } from 'config'
import { Menu } from 'features/Menu' import { Menu } from 'features/Menu'
@ -19,6 +21,7 @@ import {
type Props = { type Props = {
children?: ReactNode, children?: ReactNode,
color?: string, color?: string,
headerImage?: string | null,
height?: number, height?: number,
profileId?: number, profileId?: number,
} }
@ -26,19 +29,25 @@ type Props = {
export const ProfileHeader = ({ export const ProfileHeader = ({
children, children,
color: headerColor, color: headerColor,
headerImage,
height, height,
profileId, profileId,
}: Props) => { }: Props) => {
const color = useProfileColor(profileId) const color = useProfileColor(profileId)
const noShadow = !isNull(headerImage)
return ( return (
<Fragment> <Fragment>
<HeaderStyled color={headerColor || color} height={height}> <HeaderStyled
headerImage={headerImage}
color={headerColor || color}
height={height}
>
<Position left={1.7}> <Position left={1.7}>
<HeaderGroup marginTop={0.19}> <HeaderGroup marginTop={0.19}>
<Link to={PAGES.home}> <Link to={PAGES.home}>
<HeaderLogo /> <HeaderLogo />
</Link> </Link>
<Search /> <Search noShadow={noShadow} />
</HeaderGroup> </HeaderGroup>
</Position> </Position>

@ -9,6 +9,7 @@ export const DEFAULT_HEADER_COLOR = 'rgba(53, 96, 225, 0.56)'
type HeaderProps = { type HeaderProps = {
color?: string, color?: string,
headerImage?: string | null,
height?: number, height?: number,
} }
@ -17,12 +18,16 @@ export const HeaderStyled = styled.header<HeaderProps>`
display: flex; display: flex;
justify-content: center; justify-content: center;
height: ${({ height = 8.5 }) => height}rem; height: ${({ height = 8.5 }) => height}rem;
${({ color, headerImage }) => (headerImage
? css`background: url(${headerImage})`
: css`
background: linear-gradient( background: linear-gradient(
187deg, 187deg,
${({ color = DEFAULT_HEADER_COLOR }) => color} -4.49%, ${color || DEFAULT_HEADER_COLOR} -4.49%,
rgba(0, 0, 0, 0) 68.29%), rgba(0, 0, 0, 0) 68.29%),
#000000; #000000;
z-index: 10; z-index: 10;`
)}
${isMobileDevice ${isMobileDevice
? css` ? css`
height: 124px; height: 124px;

@ -24,7 +24,11 @@ import {
ClearButton, ClearButton,
} from './styled' } from './styled'
export const Search = () => { type Props = {
noShadow?: boolean,
}
export const Search = ({ noShadow }: Props) => {
const { const {
clearQuery, clearQuery,
close, close,
@ -54,6 +58,7 @@ export const Search = () => {
type='search' type='search'
value={query} value={query}
onChange={onChange} onChange={onChange}
noShadow={noShadow}
/> />
{(query || isOpen) && <ClearButton onClick={clearQuery} />} {(query || isOpen) && <ClearButton onClick={clearQuery} />}
{isFetching && ( {isFetching && (

@ -48,6 +48,7 @@ export const useTeamPage = () => {
return { return {
fetchMatches, fetchMatches,
headerImage: teamProfile?.header_image,
profile, profile,
sportType, sportType,
teamId, teamId,

@ -16,13 +16,17 @@ const TeamPage = () => {
usePageLogger() usePageLogger()
const { const {
fetchMatches, fetchMatches,
headerImage,
profile, profile,
teamId, teamId,
} = useTeamPage() } = useTeamPage()
return ( return (
<PageWrapper> <PageWrapper>
<ProfileHeader profileId={teamId}> <ProfileHeader
headerImage={headerImage}
profileId={teamId}
>
{profile && <ProfileCard profile={profile} />} {profile && <ProfileCard profile={profile} />}
</ProfileHeader> </ProfileHeader>
<Main> <Main>

@ -46,6 +46,7 @@ export const useTournamentPage = () => {
return { return {
fetchMatches, fetchMatches,
headerImage: tournamentProfile?.header_image,
infoItems: [country], infoItems: [country],
profile, profile,
tournamentId, tournamentId,

@ -16,13 +16,17 @@ const TournamentPage = () => {
usePageLogger() usePageLogger()
const { const {
fetchMatches, fetchMatches,
headerImage,
profile, profile,
tournamentId, tournamentId,
} = useTournamentPage() } = useTournamentPage()
return ( return (
<PageWrapper> <PageWrapper>
<ProfileHeader profileId={tournamentId}> <ProfileHeader
headerImage={headerImage}
profileId={tournamentId}
>
{profile && <ProfileCard profile={profile} />} {profile && <ProfileCard profile={profile} />}
</ProfileHeader> </ProfileHeader>
<Main> <Main>

@ -15,6 +15,7 @@ type NameObject = {
export type TeamInfo = { export type TeamInfo = {
country: NameObject, country: NameObject,
header_image: string | null,
id: number, id: number,
is_favorite: boolean, is_favorite: boolean,
name_eng: string, name_eng: string,

@ -12,6 +12,7 @@ export type TournamentInfo = {
name_eng: string, name_eng: string,
name_rus: string, name_rus: string,
}, },
header_image: string | null,
id: number, id: number,
is_favorite: boolean, is_favorite: boolean,
name_eng: string, name_eng: string,

Loading…
Cancel
Save