Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

refactor(footer): better naming for different layout & re-org#1105

Merged
mydearxym merged 3 commits intodevfromfooter-view-naming
Jul 3, 2021
Merged
Show file tree
Hide file tree
Changes fromall 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 deletionsconfig/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/components/BlinkCursor/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/components/BlinkCursor/styles/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/components/BlinkCursor/tests/index.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/components/CommunityFaceLogo/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/components/Navigator/DigestView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 deletionssrc/components/Navigator/styles/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 deletionssrc/containers/unit/Footer/DesktopView/BottomInfo.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/containers/unit/Footer/DesktopView/CommunityView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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
}

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

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

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

[8]ページ先頭

©2009-2025 Movatter.jp