fix(#493): go to home on logo click (#193)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent 9cc373a8d2
commit 7eea131fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      src/features/HeaderMobile/index.tsx
  2. 31
      src/features/HeaderMobile/styled.tsx
  3. 36
      src/features/HomePage/index.tsx
  4. 24
      src/features/UserAccount/components/PageTitle/index.tsx
  5. 9
      src/features/UserFavorites/index.tsx
  6. 2
      src/features/UserFavorites/styled.tsx

@ -1,56 +1,29 @@
import React from 'react' import React from 'react'
import { Route, Switch } from 'react-router-dom' import { Link } from 'react-router-dom'
import { PAGES } from 'config'
import { ToggleScore } from 'features/ToggleScore' import { ToggleScore } from 'features/ToggleScore'
import { Logo } from 'features/Logo' import { Logo } from 'features/Logo'
import { Menu } from 'features/Menu' import { Menu } from 'features/Menu'
import { Search } from 'features/Search' import { Search } from 'features/Search'
import {
DateFilter,
MatchStatusFilter,
} from 'features/HeaderFilters'
import { PAGES } from 'config'
import { import {
HeaderMobileWrapper, HeaderMobileWrapper,
HeaderMobileTop,
HeaderMobileOnlyTop,
HeaderMobileMidle,
HeaderMobileBottom,
HeaderIconsWrapper, HeaderIconsWrapper,
IconFavWrapper, IconFavWrapper,
} from './styled' } from './styled'
export const HeaderMobile = () => ( export const HeaderMobile = () => (
<Switch> <HeaderMobileWrapper>
<Route path={PAGES.home} exact> <ToggleScore />
<HeaderMobileWrapper> <Link to={PAGES.home}>
<HeaderMobileTop>
<ToggleScore />
<Logo width={52} height={12} />
<HeaderIconsWrapper>
<IconFavWrapper />
<Search />
<Menu />
</HeaderIconsWrapper>
</HeaderMobileTop>
<HeaderMobileMidle>
<DateFilter />
</HeaderMobileMidle>
<HeaderMobileBottom>
<MatchStatusFilter />
</HeaderMobileBottom>
</HeaderMobileWrapper>
</Route>
<HeaderMobileOnlyTop>
<ToggleScore />
<Logo width={52} height={12} /> <Logo width={52} height={12} />
<HeaderIconsWrapper> </Link>
<IconFavWrapper /> <HeaderIconsWrapper>
<Search /> <IconFavWrapper />
<Menu /> <Search />
</HeaderIconsWrapper> <Menu />
</HeaderMobileOnlyTop> </HeaderIconsWrapper>
</Switch> </HeaderMobileWrapper>
) )

@ -3,13 +3,6 @@ import styled from 'styled-components/macro'
import { Wrapper } from 'features/Menu/styled' import { Wrapper } from 'features/Menu/styled'
export const HeaderMobileWrapper = styled.div` export const HeaderMobileWrapper = styled.div`
width: 100%;
top: 0;
left: 0;
display: flex;
flex-direction: column;
`
export const HeaderMobileTop = styled.div`
width: 100%; width: 100%;
height: 40px; height: 40px;
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
@ -18,9 +11,6 @@ export const HeaderMobileTop = styled.div`
justify-content: space-between; justify-content: space-between;
padding: 12px 18px; padding: 12px 18px;
` `
export const HeaderMobileOnlyTop = styled(HeaderMobileTop)`
margin-bottom: 25px;
`
export const HeaderMobileMidle = styled.div` export const HeaderMobileMidle = styled.div`
width: 100%; width: 100%;
@ -31,6 +21,7 @@ export const HeaderMobileMidle = styled.div`
padding: 12px 18px; padding: 12px 18px;
margin-top: 6px margin-top: 6px
` `
export const HeaderMobileBottom = styled.div` export const HeaderMobileBottom = styled.div`
width: 100%; width: 100%;
display: flex; display: flex;
@ -50,28 +41,8 @@ export const HeaderIconsWrapper = styled.div`
} }
` `
export const IconSearchWrapper = styled.div`
width: 20px;
height: 20px;
margin-left: 23px;
background-image: url(/images/search-mobile.svg);
`
export const IconFavWrapper = styled.div` export const IconFavWrapper = styled.div`
width: 20px; width: 20px;
height: 20px; height: 20px;
background-image: url(/images/star-white.svg); background-image: url(/images/star-white.svg);
` `
export const DateFilterMobileWrapper = styled.div`
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`
export const BottomMenuWrapper = styled.div`
width: 100%;
position: fixed;
bottom: 0;
display: flex;
height: 40px;
background: radial-gradient( 49.07% 49.07% at 50% 29.54%, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 100% ), rgba(0,0,0,0.95);
`

@ -1,15 +1,43 @@
import React from 'react' import React, { Fragment } from 'react'
import { useMediaQuery } from 'react-responsive'
import { devices } from 'config'
import { Matches } from 'features/Matches' import { Matches } from 'features/Matches'
import {
DateFilter,
MatchStatusFilter,
} from 'features/HeaderFilters'
import {
HeaderMobileMidle,
HeaderMobileBottom,
} from 'features/HeaderMobile/styled'
import { useHomePage } from './hooks' import { useHomePage } from './hooks'
import { Content } from './styled' import { Content } from './styled'
export const HomePage = () => { export const HomePage = () => {
const isMobile = useMediaQuery({ query: devices.tablet })
const { fetchMatches } = useHomePage() const { fetchMatches } = useHomePage()
return ( return (
<Content> <Fragment>
<Matches fetch={fetchMatches} /> {
</Content> isMobile
? (
<Fragment>
<HeaderMobileMidle>
<DateFilter />
</HeaderMobileMidle>
<HeaderMobileBottom>
<MatchStatusFilter />
</HeaderMobileBottom>
</Fragment>
)
: null
}
<Content>
<Matches fetch={fetchMatches} />
</Content>
</Fragment>
) )
} }

@ -1,4 +1,7 @@
import React from 'react' import React from 'react'
import { Link, useLocation } from 'react-router-dom'
import { PAGES } from 'config'
import { Logo } from 'features/Logo' import { Logo } from 'features/Logo'
import { BlockTitle } from 'features/Login/styled' import { BlockTitle } from 'features/Login/styled'
@ -9,11 +12,16 @@ type Props = {
titleText: string, titleText: string,
} }
export const PageTitle = ({ titleText }: Props) => ( export const PageTitle = ({ titleText }: Props) => {
<PageTitleWrapper> const location = useLocation()
<Logo /> return (
<TitleTextWrapper> <PageTitleWrapper>
<BlockTitle>{titleText}</BlockTitle> <Link to={`${PAGES.home}${location.search}`}>
</TitleTextWrapper> <Logo />
</PageTitleWrapper> </Link>
) <TitleTextWrapper>
<BlockTitle>{titleText}</BlockTitle>
</TitleTextWrapper>
</PageTitleWrapper>
)
}

@ -1,9 +1,13 @@
import type { MouseEvent, FocusEvent } from 'react' import type { MouseEvent, FocusEvent } from 'react'
import React, { useState } from 'react' import React, { useState } from 'react'
import { Link, useLocation } from 'react-router-dom'
import map from 'lodash/map' import map from 'lodash/map'
import { FavoritesActions } from 'requests' import { FavoritesActions } from 'requests'
import { PAGES } from 'config'
import { Modal } from 'features/Modal' import { Modal } from 'features/Modal'
import { TooltipBlock } from './TooltipBlock' import { TooltipBlock } from './TooltipBlock'
@ -23,6 +27,7 @@ import {
} from './styled' } from './styled'
export const UserFavorites = () => { export const UserFavorites = () => {
const location = useLocation()
const { const {
addRemoveFavorite, addRemoveFavorite,
close, close,
@ -40,7 +45,9 @@ export const UserFavorites = () => {
return ( return (
<UserSportFavWrapper> <UserSportFavWrapper>
<UserSportFavLogoWrapper width={52} /> <Link to={`${PAGES.home}${location.search}`}>
<UserSportFavLogoWrapper width={52} />
</Link>
<UserSportFavStar /> <UserSportFavStar />
<ScrollWrapper> <ScrollWrapper>
{ {

@ -36,7 +36,6 @@ export const ScrollWrapper = styled.div`
export const UserSportFavLogoWrapper = styled(Logo)` export const UserSportFavLogoWrapper = styled(Logo)`
margin-top: 35px; margin-top: 35px;
margin-bottom: 120px;
@media ${devices.laptop} { @media ${devices.laptop} {
margin-top: 30px; margin-top: 30px;
@ -98,6 +97,7 @@ export const UserSportFavStar = styled.div`
border-radius: 50%; border-radius: 50%;
background: #3f3f3f url('/images/sportFavStar.png') no-repeat center; background: #3f3f3f url('/images/sportFavStar.png') no-repeat center;
margin-bottom: 16px; margin-bottom: 16px;
margin-top: 120px;
` `
export const FavoriteModal = styled.div` export const FavoriteModal = styled.div`

Loading…
Cancel
Save