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
3 changes: 3 additions & 0 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export { default as SEO } from './next_seo'

export const DEFAULT_THEME = CONFIG.DEFAULT_THEME as TThemeName

export const SITE_LOGO =
'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/static/new-logo.jpg'

export const {
GRAPHQL_ENDPOINT,
SENIOR_AMOUNT_THRESHOLD,
Expand Down
45 changes: 45 additions & 0 deletions src/components/BlinkCursor/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
*
* BlinkCursor
*
*/

import { FC, memo } from 'react'

import { buildLog } from '@/utils'

import { Wrapper } from './styles'

/* eslint-disable-next-line */
const log = buildLog('c:BlinkCursor:index')

type TProps = {
testid?: string
height?: number
top?: number
left?: number
right?: number
duration?: number
}

const BlinkCursor: FC<TProps> = ({
testid = 'blink-cursor',
height = 12,
top = 2,
left = 10,
right = 10,
duration = 2,
}) => {
return (
<Wrapper
testid={testid}
height={height}
top={top}
left={left}
right={right}
duration={duration}
/>
)
}

export default memo(BlinkCursor)
35 changes: 35 additions & 0 deletions src/components/BlinkCursor/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import styled from 'styled-components'

import type { TTestable } from '@/spec'

// import Img from '@/Img'
import { animate } from '@/utils'

export type TWrapper = TTestable & {
height: number
top: number
left: number
right: number
duration: number
}

export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
'data-test-id': testid,
}))<TWrapper>`
background-color: #139c9e;

height: ${({ height }) => `${height}px`};

margin-top: ${({ top }) => `${top}px`};
margin-left: ${({ left }) => `${left}px`};
margin-right: ${({ right }) => `${right}px`};

width: 1px;

opacity: 1;
animation: ${animate.blink} 2s linear infinite alternate;

animation-duration: ${({ duration }) => `${duration}s`};
`

export const Title = styled.div``
10 changes: 10 additions & 0 deletions src/components/BlinkCursor/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// import React from 'react'
// import { shallow } from 'enzyme'

// import BlinkCursor from '../index'

describe('TODO <BlinkCursor />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true)
})
})
9 changes: 2 additions & 7 deletions src/components/CommunityFaceLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { FC, memo } from 'react'
import { isEmpty } from 'ramda'

import { SITE_LOGO } from '@/config'
import { HCN } from '@/constant'
// import { ICON_BASE } from '@/config'
import { buildLog } from '@/utils'
Expand All @@ -32,13 +33,7 @@ const CommunityFaceLogo: FC<TProps> = ({
className = 'community-facelogo-class',
}) => {
if (raw === HCN || isEmpty(src)) {
return (
<HomeLogo
// src={`${ICON_BASE}/site_logo.svg`}
src="https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/static/new-logo.jpg"
className={className}
/>
)
return <HomeLogo src={SITE_LOGO} className={className} />
}

return (
Expand Down
10 changes: 8 additions & 2 deletions src/components/Navigator/DigestView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { FC, memo } from 'react'

import { METRIC } from '@/constant'

import BlinkCursor from '@/components/BlinkCursor'

import {
Breadcrumbs,
Logo,
LogoLink,
LogoMargin,
LineDivider,
LogoText,
OfflineWrapper,
ActionText,
Expand Down Expand Up @@ -42,7 +44,11 @@ const DigestView: FC<TProps> = ({ metric, showLogoText, isOnline, layout }) => {
{showLogoText && <LogoText>oderPlanets</LogoText>}
</LogoLink>

{showLogoText ? <LogoMargin layout={layout} /> : <LineDivider />}
{showLogoText ? (
<LogoMargin layout={layout} />
) : (
<BlinkCursor duration={1.2} height={14} left={5} right={2} />
)}

{isOnline ? (
renderMainEntries(metric)
Expand Down
10 changes: 0 additions & 10 deletions src/components/Navigator/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ export const LogoMargin = styled.div<{ layout: TC11NLayout }>`
margin-right: ${({ layout }) =>
layout === C11N.HOLY_GRAIL ? '42px' : '32px'};
`
export const LineDivider = styled.div`
background-color: #139c9e;
margin-left: 5px;
margin-right: 2px;
width: 1px;
height: 14px;
margin-top: 3px;
opacity: 1;
animation: ${animate.blink} 1.2s linear infinite alternate;
`
export const LogoText = styled.a`
color: ${theme('header.fg')};
font-weight: bold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FC, memo } from 'react'
import { ICON_CMD, EMAIL_SUPPORT } from '@/config'
import { joinUS } from '@/utils'

import { Wrapper, Item, Icon } from './styles/social_list'
import { Wrapper, Item, Icon } from './styles/contact_list'

const SocialList: FC = () => (
<Wrapper>
Expand All @@ -26,15 +26,6 @@ const SocialList: FC = () => (
<Icon src={`${ICON_CMD}/github.svg`} />
</Item>
</a>
<a
href="https://zhuanlan.zhihu.com/coderplanets"
rel="noopener noreferrer"
target="_blank"
>
<Item>
<Icon src={`${ICON_CMD}/zhihu_solid.svg`} />
</Item>
</a>
</Wrapper>
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, memo } from 'react'

import type { TArticle } from '@/spec'
import type { TArticle, TC11NLayout } from '@/spec'
import { ISSUE_ADDR, API_SERVER_ADDR } from '@/config'
import TopInfo from './TopInfo'
import BottomInfo from './BottomInfo'
Expand All @@ -11,20 +11,19 @@ import {
MainInfos,
BaseInfo,
Item,
} from '../styles/desktop_view/brief_view'
} from '../styles/desktop_view/article_view'

type TProps = {
curView: string // todo
viewingArticle: TArticle
metric: string
layout: TC11NLayout
}

const BriefView: FC<TProps> = ({ curView, metric, viewingArticle }) => {
const BriefView: FC<TProps> = ({ metric, viewingArticle, layout }) => {
return (
<Wrapper metric={metric}>
<Wrapper metric={metric} layout={layout}>
<InnerWrapper>
<TopInfo type="article" title={viewingArticle.title} noBottomBorder />
{/* <MainInfos center={curView === 'BRIEF' || false}> */}
<MainInfos>
<BaseInfo>
<Item href="/home/post/1" rel="noopener noreferrer" target="_blank">
Expand Down
5 changes: 0 additions & 5 deletions src/containers/unit/Footer/DesktopView/BottomInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { FC, memo } from 'react'

import type { TC11NLayout } from '@/spec'
import { ROUTE } from '@/constant'

import {
Wrapper,
InnerWrapper,
BeianLink,
CompanyLink,
} from '../styles/desktop_view/bottom_info'

type TProps = {
Expand All @@ -19,9 +17,6 @@ const BottomInfo: FC<TProps> = ({ metric, layout }) => {
return (
<Wrapper metric={metric}>
<InnerWrapper layout={layout}>
<CompanyLink href={ROUTE.SPONSOR}>
Groupher @ 2021. 保留所有权利。
</CompanyLink>
<BeianLink href="http://beian.miit.gov.cn">
蜀ICP备17043722号-4
</BeianLink>
Expand Down
84 changes: 84 additions & 0 deletions src/containers/unit/Footer/DesktopView/CommunityView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { FC, memo } from 'react'

import type { TArticle, TC11NLayout } from '@/spec'
import { ISSUE_ADDR, API_SERVER_ADDR } from '@/config'
import TopInfo from './TopInfo'
import BottomInfo from './BottomInfo'

import { VIEW } from '../constants'

import {
Wrapper,
InnerWrapper,
MainInfos,
BaseInfo,
Item,
} from '../styles/desktop_view/community_view'

type TProps = {
viewingArticle: TArticle
metric: string
layout: TC11NLayout
}

const CommunityView: FC<TProps> = ({ metric, layout }) => {
return (
<Wrapper metric={metric} layout={layout}>
<InnerWrapper>
<TopInfo type={VIEW.COMMUNITY} title="javascript" noBottomBorder />
<MainInfos>
<BaseInfo>
<Item href="/home/post/1" rel="noopener noreferrer" target="_blank">
关于
</Item>
<Item
href="/cps-support/posts"
rel="noopener noreferrer"
target="_blank"
>
创建社区
</Item>
<Item
href="/cps-support/posts"
rel="noopener noreferrer"
target="_blank"
>
加入我们
</Item>
<Item
href={`${API_SERVER_ADDR}`}
rel="noopener noreferrer"
target="_blank"
>
OpenSource
</Item>
<Item
href={`${API_SERVER_ADDR}`}
rel="noopener noreferrer"
target="_blank"
>
特别感谢
</Item>
<Item
href={`${ISSUE_ADDR}`}
rel="noopener noreferrer"
target="_blank"
>
反馈与建议
</Item>
<Item
href={`${ISSUE_ADDR}`}
rel="noopener noreferrer"
target="_blank"
>
开放数据
</Item>
</BaseInfo>
</MainInfos>
</InnerWrapper>
<BottomInfo metric={metric} />
</Wrapper>
)
}

export default memo(CommunityView)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import type { TThemeMap, TC11NLayout } from '@/spec'
import { GITHUB, API_SERVER_ADDR, ISSUE_ADDR, BUILD_VERSION } from '@/config'
import { ROUTE } from '@/constant'

import TopInfo from '../TopInfo'
import BottomInfo from '../BottomInfo'
import SocialList from '../../SocialList'
import TopInfo from './TopInfo'
import BottomInfo from './BottomInfo'
import SocialList from '../ContactList'

import {
Wrapper,
Expand All @@ -18,14 +18,14 @@ import {
Body,
Item,
LinkItem,
} from '../../styles/desktop_view/digest_view'
} from '../styles/desktop_view/home_view'

type TProps = {
metric: string
layout: TC11NLayout
}

const DigestView: FC<TProps> = ({ metric, layout }) => {
const HomeView: FC<TProps> = ({ metric, layout }) => {
const theme = useTheme() as TThemeMap

const linkColors = {
Expand Down Expand Up @@ -166,4 +166,4 @@ const DigestView: FC<TProps> = ({ metric, layout }) => {
)
}

export default memo(DigestView)
export default memo(HomeView)
Loading