Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Buttons/ArrowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type TProps = {
children?: React.ReactNode
onClick?: () => void
size?: TSIZE
direction: 'left' | 'right'
direction?: 'left' | 'right'
dimWhenIdle?: boolean
disabled?: boolean
arrowStyle?: string
Expand Down
11 changes: 3 additions & 8 deletions src/containers/content/CoolGuideContent/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
import React from 'react'

import { GUIDE } from '@/constant'
import { mockNaviCatalogMenu } from '@/utils'

import Pagi from '@/components/Pagi'

import {
DirectoryGallery,
ProductGallery,
PeopleGallery,
ImageGallery,
} from '@/components/GalleryHub'

import SearchCover from './SearchCover'
import Footer from './Footer'
// import NormalList from './NormalList'

import { Wrapper, InnerWrapper, NormalListWrapper } from './styles/content'

type TProps = {
Expand All @@ -33,11 +32,7 @@ const Content: React.FC<TProps> = ({ displayType }) => {
case GUIDE.PREVIEW: {
DisplayContent = (
<NormalListWrapper>
<DirectoryGallery items={mockNaviCatalogMenu()} />
<br />
<Footer />
<br />
<br />
<SearchCover />
</NormalListWrapper>
)
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,27 @@ import {
const FAKE_AVATAR =
'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/cmd/hot/hackernews.jpeg'

const Footer = () => {
type TProps = {
mode?: string
}

const Footer: React.FC<TProps> = ({ mode }) => {
return (
<Wrapper>
<Wrapper center={mode === 'cover'}>
<AboutBlock>
关于酷导游
关于酷导航
<Desc>共收录信息 3485 条,最后更新:3小时前</Desc>
<ArrowButton>参与贡献</ArrowButton>
</AboutBlock>
<AboutBlock>
关于本周热榜
<Desc>共有 RSS 源 334 个,最后抓取:3小时前</Desc>
<ArrowButton>参与贡献</ArrowButton>
<ArrowButton>更多</ArrowButton>
</AboutBlock>
{mode !== 'cover' && (
<AboutBlock>
关于本周热榜
<Desc>共有 RSS 源 334 个,最后抓取:3小时前</Desc>
<ArrowButton>参与贡献</ArrowButton>
</AboutBlock>
)}
<ContributorBlock>
本条目贡献者
贡献者们
<ContributorsWrapper>
<Avatar src={FAKE_AVATAR} />
<Avatar src={FAKE_AVATAR} />
Expand Down
58 changes: 58 additions & 0 deletions src/containers/content/CoolGuideContent/SearchCover/InputBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { useRef } from 'react'
import T from 'prop-types'

import {
Wrapper,
InputWrapper,
InputMask,
MaskNumer,
InputBar,
} from '../styles/search_cover/input_box'

type TProps = {
showMask?: boolean
placeholder?: string
value?: string
autoFocus?: boolean
noRound?: boolean

onChange?: (e) => void
onBlur?: () => void
}

const InputBox: React.FC<TProps> = ({
showMask = false,
value = '',
placeholder = '',
autoFocus = false,
onChange = console.log,
onBlur = console.log,
noRound = false,
}) => {
const ref = useRef(null)

return (
<Wrapper>
<InputWrapper noRound={noRound}>
<InputMask
show={showMask}
onClick={() => {
ref.current.focus()
}}
>
<MaskNumer>--</MaskNumer> xxx
</InputMask>
<InputBar
ref={ref}
onChange={onChange}
value={value}
autoFocus={autoFocus}
placeholder={placeholder}
onBlur={onBlur}
/>
</InputWrapper>
</Wrapper>
)
}

export default React.memo(InputBox)
29 changes: 29 additions & 0 deletions src/containers/content/CoolGuideContent/SearchCover/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'

import { Br } from '@/components/Common'

import Footer from '../Footer'
import InputBox from './InputBox'

import { Wrapper, Header, Title, Slogan } from '../styles/search_cover'

type TProps = {
testid?: string
}

const SearchCover: React.FC<TProps> = ({ testid = 'search-cover' }) => {
return (
<Wrapper testid={testid}>
<Header>
<Title>「酷导航」</Title>
<Slogan>实用指南,启发灵感,找到有趣</Slogan>
</Header>
<Br top={10} />
<InputBox />
<Br top={15} />
<Footer mode="cover" />
</Wrapper>
)
}

export default React.memo(SearchCover)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import styled from 'styled-components'
import Img from '@/Img'
import { css, theme } from '@/utils'

export const Wrapper = styled.div`
export const Wrapper = styled.div<{ center: boolean }>`
${css.flex()};
justify-content: ${({ center }) => (center ? 'center' : 'flex-start')};
width: 100%;
min-height: 160px;
color: ${theme('thread.articleTitle')};
Expand Down
1 change: 1 addition & 0 deletions src/containers/content/CoolGuideContent/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
}))<TTestable>`
${css.flexColumn('align-both')}
width: 100%;
margin-top: 12px;
`
export const InnerWrapper = styled.div<{ metric: string }>`
${css.flex('justify-center')};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import styled from 'styled-components'

import type { TTestable } from '@/spec'
import { css, theme } from '@/utils'

export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
'data-test-id': testid,
}))<TTestable>`
${css.flexColumn('align-both')};
width: 100%;
min-height: 70vh;
padding-right: 10%;
`
export const Header = styled.div`
${css.flexColumn('align-center')};
margin-bottom: 20px;
`
export const Title = styled.div`
font-size: 20px;
color: ${theme('thread.articleTitle')};
`
export const Slogan = styled.div`
font-size: 15px;
color: ${theme('thread.articleDigest')};
margin-top: 5px;
`
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import styled from 'styled-components'

import type { TActive } from '@/spec'
// import Img from '@/Img'
import { theme, css } from '@/utils'

export const Wrapper = styled.div`
display: flex;
margin-bottom: 10px;
`
export const InputWrapper = styled.div<{ noRound: boolean }>`
position: relative;
width: 520px;
${css.flex('align-center')};
border-radius: ${({ noRound }) => (noRound ? '6px' : '20px')};
padding: 10px 18px;
background-color: #093342; // ${theme('content.cardBg')};
margin-bottom: 8px;
opacity: 0.8;
border: 1px solid;
border-color: ${theme('content.cardBg')};
&:hover {
background-color: ${theme('content.cardBg')};
opacity: 1;
border: 1px solid #1e6184;
}

transition: all 0.25s ease-in;

${css.media.mobile`
width: 70%;
margin-left: 15%;
padding: 8px;
`};
`
export const InputMask = styled.div<TActive>`
${css.flex('align-both')};
position: absolute;
display: ${({ show }) => (show ? 'flex' : 'none')};
top: 0;
left: 18px;
width: 400px;
height: 40px;
`
export const MaskNumer = styled.span`
color: #327faf;
margin-right: 4px;
`
export const InputBar = styled.input.attrs(() => ({
spellCheck: 'false',
autoComplete: 'off',
autoCorrect: 'off',
autoCapitalize: 'off',
}))`
text-align: left;
caret-color: #33b7b3;
flex-grow: 1;
height: 100%;
width: auto;
min-width: 420px;
outline: none;
color: #33b7b3;
font-size: 1.1rem;
max-height: none;
background-color: transparent;
border: 0;
border-radius: 0;
transition: all 400ms ease;

::placeholder {
color: #135868;
}
`
13 changes: 7 additions & 6 deletions utils/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ export const mockNaviCatalogMenu = (): TMenuItem[] => {
icon: `${ICON_CMD}/navi/sci-fi.svg`,
displayType: 'IMAGE',
},
{
id: uid.gen(),
title: '在线教育',
icon: `${ICON_CMD}/navi/sci-fi.svg`,
displayType: 'IMAGE',
},
{
id: uid.gen(),
title: '算法体操',
Expand Down Expand Up @@ -625,7 +631,7 @@ export const mockNaviCatalogMenu = (): TMenuItem[] => {
},
{
id: uid.gen(),
title: '教程 / 翻译', // 技术书籍,中文文档, 翻译文章, 国外网校, 比如 https://web.stanford.edu/class/cs224n/
title: '教程 / 101', // 技术书籍,中文文档, 翻译(放标签里吧), 国外网校, 比如 https://web.stanford.edu/class/cs224n/
icon: `${ICON_CMD}/navi/glasses.svg`,
childMenu: [
{
Expand Down Expand Up @@ -658,11 +664,6 @@ export const mockNaviCatalogMenu = (): TMenuItem[] => {
title: '产品',
icon: `${ICON_CMD}/navi/translate.svg`,
},
{
id: uid.gen(),
title: '中文文档',
icon: `${ICON_CMD}/navi/translate.svg`,
},
{
id: uid.gen(),
title: '奇奇怪怪',
Expand Down