Ott 305 responsive match page (#104)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Sergiu 5 years ago committed by GitHub
parent c2c5e9ad0c
commit 34063ffa7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/features/App/AuthenticatedApp.tsx
  2. 7
      src/features/Header/styled.tsx
  3. 55
      src/features/HeaderMobile/index.tsx
  4. 28
      src/features/MatchPage/MatchProfileCard/styled.tsx
  5. 16
      src/features/MatchPage/styled.tsx
  6. 2
      src/features/Menu/styled.tsx
  7. 7
      src/features/Search/index.tsx
  8. 7
      src/features/Search/styled.tsx
  9. 1
      src/features/TournamentPage/hooks.tsx

@ -3,6 +3,7 @@ import {
Route, Route,
Redirect, Redirect,
Switch, Switch,
useRouteMatch,
} from 'react-router-dom' } from 'react-router-dom'
import { indexLexics } from 'config/lexics/indexLexics' import { indexLexics } from 'config/lexics/indexLexics'
@ -33,6 +34,7 @@ import { BottomMenuWrapper } from 'features/HeaderMobile/styled'
export const AuthenticatedApp = () => { export const AuthenticatedApp = () => {
useLexicsConfig(indexLexics) useLexicsConfig(indexLexics)
const isMobile = useMediaQuery({ query: devices.tablet }) const isMobile = useMediaQuery({ query: devices.tablet })
const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact
return ( return (
<ScoreStore> <ScoreStore>
@ -82,7 +84,7 @@ export const AuthenticatedApp = () => {
<MatchPage /> <MatchPage />
</Route> </Route>
{ {
isMobile isMobile && !isMatch
? ( ? (
<BottomMenuWrapper> <BottomMenuWrapper>
<SportTypeFilter /> <SportTypeFilter />

@ -22,6 +22,7 @@ export const Wrapper = styled.header`
@media${devices.laptop} { @media${devices.laptop} {
padding-top: 11px; padding-top: 11px;
margin-bottom: 0;
} }
` `
@ -45,6 +46,10 @@ export const SearchWrapper = styled(FilterWrapper)`
:focus { :focus {
width: 288px; width: 288px;
} }
&:only-child {
width: 244px;
}
} }
` `
@ -65,6 +70,6 @@ export const MenuWrapper = styled.div`
margin-right: 57px; margin-right: 57px;
@media${devices.laptop} { @media${devices.laptop} {
margin-right: 24px; margin-right: 14px;
} }
` `

@ -1,5 +1,5 @@
import React from 'react' import React, { Fragment } from 'react'
// import { useRouteMatch } from 'react-router-dom' import { useRouteMatch } from 'react-router-dom'
import { ToggleScore } from 'features/ToggleScore' import { ToggleScore } from 'features/ToggleScore'
import { Logo } from 'features/Logo' import { Logo } from 'features/Logo'
@ -9,6 +9,7 @@ import {
DateFilter, DateFilter,
MatchStatusFilter, MatchStatusFilter,
} from 'features/HeaderFilters' } from 'features/HeaderFilters'
import { PAGES } from 'config'
import { import {
HeaderMobileWrapper, HeaderMobileWrapper,
@ -19,22 +20,34 @@ import {
IconFavWrapper, IconFavWrapper,
} from './styled' } from './styled'
export const HeaderMobile = () => ( export const HeaderMobile = () => {
<HeaderMobileWrapper> const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact
<HeaderMobileTop>
<ToggleScore /> return (
<Logo /> <Fragment>
<HeaderIconsWrapper> {
<IconFavWrapper /> isMatch
<Search /> ? null
<Menu /> : (
</HeaderIconsWrapper> <HeaderMobileWrapper>
</HeaderMobileTop> <HeaderMobileTop>
<HeaderMobileMidle> <ToggleScore />
<DateFilter /> <Logo />
</HeaderMobileMidle> <HeaderIconsWrapper>
<HeaderMobileBottom> <IconFavWrapper />
<MatchStatusFilter /> <Search />
</HeaderMobileBottom> <Menu />
</HeaderMobileWrapper> </HeaderIconsWrapper>
) </HeaderMobileTop>
<HeaderMobileMidle>
<DateFilter />
</HeaderMobileMidle>
<HeaderMobileBottom>
<MatchStatusFilter />
</HeaderMobileBottom>
</HeaderMobileWrapper>
)
}
</Fragment>
)
}

@ -1,5 +1,7 @@
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { devices } from 'config/devices'
export const Wrapper = styled.div` export const Wrapper = styled.div`
display: flex; display: flex;
font-weight: bold; font-weight: bold;
@ -7,10 +9,18 @@ export const Wrapper = styled.div`
line-height: 24px; line-height: 24px;
color: white; color: white;
min-height: 28px; min-height: 28px;
@media${devices.tablet} {
order: 2;
font-size: 16px;
padding: 15px 20px 0 20px;
flex-wrap: wrap;
}
` `
export const Teams = styled.div` export const Teams = styled.div`
display: flex; display: flex;
` `
export const Dash = styled.span` export const Dash = styled.span`
@ -20,11 +30,22 @@ export const Dash = styled.span`
margin: 0 15px; margin: 0 15px;
height: fit-content; height: fit-content;
align-self: center; align-self: center;
@media${devices.tablet} {
width: 16px;
border-bottom: 1px solid white;
margin: 0 4px;
}
` `
export const Score = styled.div` export const Score = styled.div`
display: flex; display: flex;
margin-left: 48px; margin-left: 48px;
@media${devices.tablet} {
margin-left: 8px;
color: #EACB6F;
}
` `
export const Tournament = styled.div` export const Tournament = styled.div`
@ -35,4 +56,11 @@ export const Tournament = styled.div`
align-self: flex-end; align-self: flex-end;
margin-left: 48px; margin-left: 48px;
color: #666666; color: #666666;
@media${devices.tablet} {
width: 100%;
margin-left: 0;
margin-top: 4px;
font-size: 11px;
}
` `

@ -1,7 +1,18 @@
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { devices } from 'config/devices'
export const MainWrapper = styled.div` export const MainWrapper = styled.div`
margin: 63px 16px 0 16px; margin: 63px 16px 0 16px;
@media${devices.laptop} {
margin: 0px 16px;
}
@media${devices.tablet} {
display: flex;
flex-direction: column;
margin: 0 0 16px 0;
}
` `
export const Container = styled.div` export const Container = styled.div`
@ -10,4 +21,9 @@ export const Container = styled.div`
margin-top: 14px; margin-top: 14px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@media${devices.tablet} {
order: 1;
margin-top: 0;
}
` `

@ -16,7 +16,7 @@ export const Wrapper = styled.nav`
@media${devices.desktop} { @media${devices.desktop} {
margin-left: 23px; margin-left: 23px;
margin-right: 0; margin-right: 10px;
} }
` `
export const ToggleButton = styled.button` export const ToggleButton = styled.button`

@ -1,7 +1,8 @@
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import { useRouteMatch } from 'react-router-dom'
import isEmpty from 'lodash/isEmpty' import isEmpty from 'lodash/isEmpty'
import { PAGES } from 'config'
import { Input } from 'features/Common' import { Input } from 'features/Common'
import { ItemsList } from 'features/ItemsList' import { ItemsList } from 'features/ItemsList'
import { OutsideClick } from 'features/OutsideClick' import { OutsideClick } from 'features/OutsideClick'
@ -27,11 +28,11 @@ export const Search = () => {
onSubmit, onSubmit,
showResults, showResults,
} = useSearch() } = useSearch()
const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact || false
return ( return (
<OutsideClick onClick={close}> <OutsideClick onClick={close}>
<Wrapper> <Wrapper>
<Form role='search' onSubmit={onSubmit}> <Form role='search' onSubmit={onSubmit} isMatch={isMatch}>
<Input <Input
id='searchInput' id='searchInput'
type='search' type='search'

@ -11,10 +11,9 @@ import {
export const Wrapper = styled.div` export const Wrapper = styled.div`
position: relative; position: relative;
} }
` `
export const Form = styled.form` export const Form = styled.form<{isMatch: boolean}>`
width: 288px; width: 288px;
${InputWrapper} { ${InputWrapper} {
@ -34,11 +33,11 @@ export const Form = styled.form`
} }
@media${devices.desktop} { @media${devices.desktop} {
width: 51px; width: ${({ isMatch }) => (isMatch ? '244px' : '51px')};
:focus-within { :focus-within {
width: 348px; width: 348px;
position: absolute; position: ${({ isMatch }) => (isMatch ? 'static' : 'absolute')};
z-index: 4; z-index: 4;
} }
} }

@ -45,7 +45,6 @@ export const useTournamentPage = () => {
tournamentId, tournamentId,
]) ])
useEffect(() => { useEffect(() => {
getMatches({ getMatches({
date: selectedDateFormatted, date: selectedDateFormatted,

Loading…
Cancel
Save