Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 97b24b7

Browse files
authored
refactor(footer): better naming for different layout & re-org (#1105)
* refactor(footer): re-org * refactor(footer): adjust holyGrail layout width, padding * chore(footer): add darken bg on HomeView
1 parent e6ed039 commit 97b24b7

File tree

26 files changed

+412
-107
lines changed

26 files changed

+412
-107
lines changed

config/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export { default as SEO } from './next_seo'
77

88
export const DEFAULT_THEME = CONFIG.DEFAULT_THEME as TThemeName
99

10+
export const SITE_LOGO =
11+
'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/static/new-logo.jpg'
12+
1013
export const {
1114
GRAPHQL_ENDPOINT,
1215
SENIOR_AMOUNT_THRESHOLD,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
*
3+
* BlinkCursor
4+
*
5+
*/
6+
7+
import { FC, memo } from 'react'
8+
9+
import { buildLog } from '@/utils'
10+
11+
import { Wrapper } from './styles'
12+
13+
/* eslint-disable-next-line */
14+
const log = buildLog('c:BlinkCursor:index')
15+
16+
type TProps = {
17+
testid?: string
18+
height?: number
19+
top?: number
20+
left?: number
21+
right?: number
22+
duration?: number
23+
}
24+
25+
const BlinkCursor: FC<TProps> = ({
26+
testid = 'blink-cursor',
27+
height = 12,
28+
top = 2,
29+
left = 10,
30+
right = 10,
31+
duration = 2,
32+
}) => {
33+
return (
34+
<Wrapper
35+
testid={testid}
36+
height={height}
37+
top={top}
38+
left={left}
39+
right={right}
40+
duration={duration}
41+
/>
42+
)
43+
}
44+
45+
export default memo(BlinkCursor)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import styled from 'styled-components'
2+
3+
import type { TTestable } from '@/spec'
4+
5+
// import Img from '@/Img'
6+
import { animate } from '@/utils'
7+
8+
export type TWrapper = TTestable & {
9+
height: number
10+
top: number
11+
left: number
12+
right: number
13+
duration: number
14+
}
15+
16+
export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
17+
'data-test-id': testid,
18+
}))<TWrapper>`
19+
background-color: #139c9e;
20+
21+
height: ${({ height }) => `${height}px`};
22+
23+
margin-top: ${({ top }) => `${top}px`};
24+
margin-left: ${({ left }) => `${left}px`};
25+
margin-right: ${({ right }) => `${right}px`};
26+
27+
width: 1px;
28+
29+
opacity: 1;
30+
animation: ${animate.blink} 2s linear infinite alternate;
31+
32+
animation-duration: ${({ duration }) => `${duration}s`};
33+
`
34+
35+
export const Title = styled.div``
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// import React from 'react'
2+
// import { shallow } from 'enzyme'
3+
4+
// import BlinkCursor from '../index'
5+
6+
describe('TODO <BlinkCursor />', () => {
7+
it('Expect to have unit tests specified', () => {
8+
expect(true).toEqual(true)
9+
})
10+
})

src/components/CommunityFaceLogo/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { FC, memo } from 'react'
88
import { isEmpty } from 'ramda'
99

10+
import { SITE_LOGO } from '@/config'
1011
import { HCN } from '@/constant'
1112
// import { ICON_BASE } from '@/config'
1213
import { buildLog } from '@/utils'
@@ -32,13 +33,7 @@ const CommunityFaceLogo: FC<TProps> = ({
3233
className = 'community-facelogo-class',
3334
}) => {
3435
if (raw === HCN || isEmpty(src)) {
35-
return (
36-
<HomeLogo
37-
// src={`${ICON_BASE}/site_logo.svg`}
38-
src="https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/static/new-logo.jpg"
39-
className={className}
40-
/>
41-
)
36+
return <HomeLogo src={SITE_LOGO} className={className} />
4237
}
4338

4439
return (

src/components/Navigator/DigestView.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { FC, memo } from 'react'
22

33
import { METRIC } from '@/constant'
4+
5+
import BlinkCursor from '@/components/BlinkCursor'
6+
47
import {
58
Breadcrumbs,
69
Logo,
710
LogoLink,
811
LogoMargin,
9-
LineDivider,
1012
LogoText,
1113
OfflineWrapper,
1214
ActionText,
@@ -42,7 +44,11 @@ const DigestView: FC<TProps> = ({ metric, showLogoText, isOnline, layout }) => {
4244
{showLogoText && <LogoText>oderPlanets</LogoText>}
4345
</LogoLink>
4446

45-
{showLogoText ? <LogoMargin layout={layout} /> : <LineDivider />}
47+
{showLogoText ? (
48+
<LogoMargin layout={layout} />
49+
) : (
50+
<BlinkCursor duration={1.2} height={14} left={5} right={2} />
51+
)}
4652

4753
{isOnline ? (
4854
renderMainEntries(metric)

src/components/Navigator/styles/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ export const LogoMargin = styled.div<{ layout: TC11NLayout }>`
2626
margin-right: ${({ layout }) =>
2727
layout === C11N.HOLY_GRAIL ? '42px' : '32px'};
2828
`
29-
export const LineDivider = styled.div`
30-
background-color: #139c9e;
31-
margin-left: 5px;
32-
margin-right: 2px;
33-
width: 1px;
34-
height: 14px;
35-
margin-top: 3px;
36-
opacity: 1;
37-
animation: ${animate.blink} 1.2s linear infinite alternate;
38-
`
3929
export const LogoText = styled.a`
4030
color: ${theme('header.fg')};
4131
font-weight: bold;

src/containers/unit/Footer/SocialList.tsx renamed to src/containers/unit/Footer/ContactList.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FC, memo } from 'react'
33
import { ICON_CMD, EMAIL_SUPPORT } from '@/config'
44
import { joinUS } from '@/utils'
55

6-
import { Wrapper, Item, Icon } from './styles/social_list'
6+
import { Wrapper, Item, Icon } from './styles/contact_list'
77

88
const SocialList: FC = () => (
99
<Wrapper>
@@ -26,15 +26,6 @@ const SocialList: FC = () => (
2626
<Icon src={`${ICON_CMD}/github.svg`} />
2727
</Item>
2828
</a>
29-
<a
30-
href="https://zhuanlan.zhihu.com/coderplanets"
31-
rel="noopener noreferrer"
32-
target="_blank"
33-
>
34-
<Item>
35-
<Icon src={`${ICON_CMD}/zhihu_solid.svg`} />
36-
</Item>
37-
</a>
3829
</Wrapper>
3930
)
4031

src/containers/unit/Footer/DesktopView/BriefView.tsx renamed to src/containers/unit/Footer/DesktopView/ArticleView.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC, memo } from 'react'
22

3-
import type { TArticle } from '@/spec'
3+
import type { TArticle, TC11NLayout } from '@/spec'
44
import { ISSUE_ADDR, API_SERVER_ADDR } from '@/config'
55
import TopInfo from './TopInfo'
66
import BottomInfo from './BottomInfo'
@@ -11,20 +11,19 @@ import {
1111
MainInfos,
1212
BaseInfo,
1313
Item,
14-
} from '../styles/desktop_view/brief_view'
14+
} from '../styles/desktop_view/article_view'
1515

1616
type TProps = {
17-
curView: string // todo
1817
viewingArticle: TArticle
1918
metric: string
19+
layout: TC11NLayout
2020
}
2121

22-
const BriefView: FC<TProps> = ({ curView, metric, viewingArticle }) => {
22+
const BriefView: FC<TProps> = ({ metric, viewingArticle, layout }) => {
2323
return (
24-
<Wrapper metric={metric}>
24+
<Wrapper metric={metric} layout={layout}>
2525
<InnerWrapper>
2626
<TopInfo type="article" title={viewingArticle.title} noBottomBorder />
27-
{/* <MainInfos center={curView === 'BRIEF' || false}> */}
2827
<MainInfos>
2928
<BaseInfo>
3029
<Item href="/home/post/1" rel="noopener noreferrer" target="_blank">

src/containers/unit/Footer/DesktopView/BottomInfo.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { FC, memo } from 'react'
22

33
import type { TC11NLayout } from '@/spec'
4-
import { ROUTE } from '@/constant'
54

65
import {
76
Wrapper,
87
InnerWrapper,
98
BeianLink,
10-
CompanyLink,
119
} from '../styles/desktop_view/bottom_info'
1210

1311
type TProps = {
@@ -19,9 +17,6 @@ const BottomInfo: FC<TProps> = ({ metric, layout }) => {
1917
return (
2018
<Wrapper metric={metric}>
2119
<InnerWrapper layout={layout}>
22-
<CompanyLink href={ROUTE.SPONSOR}>
23-
Groupher @ 2021. 保留所有权利。
24-
</CompanyLink>
2520
<BeianLink href="http://beian.miit.gov.cn">
2621
蜀ICP备17043722号-4
2722
</BeianLink>

0 commit comments

Comments
 (0)