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

Commit 41e3d59

Browse files
committed
chore(face): brand title & footer naming, style
1 parent ee19f18 commit 41e3d59

File tree

30 files changed

+385
-102
lines changed

30 files changed

+385
-102
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
*
3+
* BrandTitle
4+
*
5+
*/
6+
7+
import { FC, memo } from 'react'
8+
9+
import { buildLog } from '@/utils/logger'
10+
import { SpaceGrow } from '@/components/Common'
11+
12+
import { Wrapper, Title, Desc, BrandText } from './styles'
13+
14+
/* eslint-disable-next-line */
15+
const log = buildLog('c:BrandTitle:index')
16+
17+
type TProps = {
18+
testid?: string
19+
title?: string
20+
desc?: string
21+
mBottom?: number
22+
fontSize?: number
23+
}
24+
25+
const BrandTitle: FC<TProps> = ({
26+
testid = 'brand-title',
27+
title = 'hello?',
28+
desc = 'what for?',
29+
mBottom = 10,
30+
fontSize = 18,
31+
}) => {
32+
return (
33+
<Wrapper testid={testid} mBottom={mBottom}>
34+
<Title>
35+
<BrandText fontSize={fontSize}>{title}</BrandText>
36+
<SpaceGrow />
37+
</Title>
38+
<Desc>{desc}</Desc>
39+
</Wrapper>
40+
)
41+
}
42+
43+
export default memo(BrandTitle)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import styled from 'styled-components'
2+
3+
import type { TTestable } from '@/spec'
4+
5+
// import Img from '@/Img'
6+
import { theme } from '@/utils/themes'
7+
import css from '@/utils/css'
8+
9+
type TWrapper = TTestable & { mBottom: number }
10+
export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
11+
'data-test-id': testid,
12+
}))<TWrapper>`
13+
margin-bottom: ${({ mBottom }) => `${mBottom}px`};
14+
`
15+
export const Title = styled.div`
16+
${css.flex()};
17+
`
18+
export const Desc = styled.div`
19+
color: ${theme('thread.articleDigest')};
20+
font-size: 13px;
21+
margin-top: 15px;
22+
`
23+
type TBrandText = { fontSize: number }
24+
export const BrandText = styled.div<TBrandText>`
25+
color: ${theme('thread.articleTitle')};
26+
font-size: ${({ fontSize }) => `${fontSize}px`};
27+
font-weight: bold;
28+
padding: 0 4px;
29+
border-radius: 3px;
30+
letter-spacing: 1px;
31+
32+
background: linear-gradient(
33+
to top,
34+
#003b49 35%,
35+
transparent 35%,
36+
transparent 80%
37+
);
38+
`
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 BrandTitle from '../index'
5+
6+
describe('TODO <BrandTitle />', () => {
7+
it('Expect to have unit tests specified', () => {
8+
expect(true).toEqual(true)
9+
})
10+
})
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
*
3+
* Header
4+
*
5+
*/
6+
7+
import { FC, memo } from 'react'
8+
import { contains } from 'ramda'
9+
import dynamic from 'next/dynamic'
10+
11+
import type { TMetric } from '@/spec'
12+
import { METRIC } from '@/constant'
13+
import { buildLog } from '@/utils/logger'
14+
15+
import Navigator from '@/components/Navigator'
16+
17+
import type { TProps } from '../index'
18+
import {
19+
Wrapper,
20+
InnerWrapper,
21+
RouterWrapper,
22+
} from '../styles/desktop_view/general_layout'
23+
24+
/* eslint-disable-next-line */
25+
const log = buildLog('C:Header')
26+
27+
// let MailBox
28+
const AddOns = dynamic(() => import('../AddOns'), { ssr: false })
29+
30+
const hasNoBorder = (metric: TMetric): boolean =>
31+
contains(metric, [
32+
METRIC.DISCOVERY,
33+
METRIC.SPONSOR,
34+
METRIC.SUPPORT_US,
35+
METRIC.SUBSCRIBE,
36+
METRIC.ARTICLE,
37+
METRIC.MEMBERSHIP,
38+
METRIC.USER,
39+
METRIC.COMMUNITY_EDITOR,
40+
METRIC.HELP_CENTER,
41+
])
42+
43+
const GeneralHeader: FC<TProps> = ({ metric, c11n, community }) => {
44+
return (
45+
<Wrapper
46+
id="whereCallShowDoraemon"
47+
testid="header"
48+
noBorder={hasNoBorder(metric)}
49+
>
50+
<InnerWrapper metric={metric}>
51+
<RouterWrapper>
52+
<Navigator
53+
community={community}
54+
layout={c11n.bannerLayout}
55+
metric={metric}
56+
/>
57+
</RouterWrapper>
58+
<AddOns />
59+
</InnerWrapper>
60+
</Wrapper>
61+
)
62+
}
63+
64+
export default memo(GeneralHeader)

src/components/Header/DesktopView/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { METRIC } from '@/constant'
55
import type { TProps } from '../index'
66
import CommunityLayout from './CommunityLayout'
77
import ArticleLayout from './ArticleLayout'
8-
import WorksLayout from './WorksLayout'
8+
// import WorksLayout from './WorksLayout'
9+
import GeneralLayout from './GeneralLayout'
910
// import ArticleEditorView from './ArticleEditorView'
1011

1112
const DesktopView: FC<TProps> = (props) => {
@@ -17,14 +18,11 @@ const DesktopView: FC<TProps> = (props) => {
1718
case METRIC.WORKS_ARTICLE: {
1819
return <ArticleLayout {...props} />
1920
}
20-
case METRIC.WORKS: {
21-
return <WorksLayout {...props} />
21+
case METRIC.COMMUNITY: {
22+
return <CommunityLayout {...props} />
2223
}
23-
// case METRIC.ARTICLE_EDITOR: {
24-
// return <ArticleEditorView metric={metric} />
25-
// }
2624
default: {
27-
return <CommunityLayout {...props} />
25+
return <GeneralLayout {...props} />
2826
}
2927
}
3028
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import styled from 'styled-components'
2+
3+
import type { TTestable, TMetric } from '@/spec'
4+
import { theme } from '@/utils/themes'
5+
import css from '@/utils/css'
6+
7+
type TPos = {
8+
noBorder: boolean
9+
}
10+
11+
type IWrapper = TPos & TTestable
12+
13+
export const Wrapper = styled.header.attrs(({ testid }: TTestable) => ({
14+
'data-test-id': testid,
15+
}))<IWrapper>`
16+
width: 100%;
17+
height: 33px;
18+
${css.flex('justify-center')};
19+
background: ${theme('header.bg')};
20+
opacity: 1;
21+
border-bottom: ${({ noBorder }) => (noBorder ? 'none' : '1px solid')};
22+
border-bottom-color: ${theme('header.spliter')};
23+
box-shadow: ${({ noBorder }) => (noBorder ? 'none' : theme('drawer.shadow'))};
24+
`
25+
26+
type TInnerWrapper = { metric: TMetric }
27+
28+
export const InnerWrapper = styled.div<TInnerWrapper>`
29+
${css.flex('align-center')};
30+
width: 100%;
31+
height: 33px;
32+
${({ metric }) => css.fitContentWidth(metric)};
33+
padding-left: 0;
34+
padding-right: 0;
35+
`
36+
export const RouterWrapper = styled.div`
37+
${css.flexGrow('align-center')};
38+
height: 100%;
39+
`

src/components/NaviCatalog/index.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { getQueryFromUrl, markRoute } from '@/utils/route'
1818
import type { TMenuMode } from './spec'
1919
import { ROOT_MENU, CHILD_MENU } from './constant'
2020

21-
import Button from '@/components/Buttons/Button'
2221
import Header from './Header'
2322
import Dashboard from './Dashboard'
2423
import List from './List'
@@ -196,16 +195,6 @@ const NaviCatalog: FC<TProps> = ({
196195
onReset={handleReset}
197196
viewPath={viewPath}
198197
/>
199-
<Button
200-
ghost
201-
size="small"
202-
onClick={() => {
203-
const ret = tags2Menu(tags)
204-
console.log('ret =>: ', ret)
205-
}}
206-
>
207-
test
208-
</Button>
209198
<Dashboard viewPath={viewPath} goCatalog={handleGoCatalog} />
210199
<List
211200
menuMode={menuMode}

src/containers/content/CoolGuideContent/FilterBar.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ICON_CMD } from '@/config'
44
import { mockNaviCatalogTags } from '@/utils/mock'
55

66
import Sticky from '@/components/Sticky'
7-
import NaviIntro from '@/components/NaviIntro'
7+
import BrandTitle from '@/components/BrandTitle'
88
import NaviCatalog from '@/components/NaviCatalog'
99

1010
import {
@@ -28,11 +28,8 @@ const FilterBar: FC<TProps> = ({ topFilter, menuOnSelect }) => {
2828
return (
2929
<Wrapper testid="filter-bar">
3030
<TopFilter>
31-
<NaviIntro
32-
title="酷导航"
33-
desc="the cool guide"
34-
iconSrc={`${ICON_CMD}/navi/cool-guide-logo.svg`}
35-
/>
31+
<BrandTitle title="酷导航" desc="实用指南,启发灵感,找到有趣" />
32+
<Divider />
3633
{topFilter !== 'all' && (
3734
<Option onClick={() => topFilterOnChange('all')}>全部</Option>
3835
)}

src/containers/content/CoolGuideContent/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import { useInit, menuOnSelect } from './logic'
2121
const log = buildLog('C:CoolGuideContent')
2222

2323
type TProps = {
24-
coolGuideContent: TStore
25-
metric: TMetric
24+
coolGuideContent?: TStore
25+
metric?: TMetric
2626
testid?: string
2727
}
2828

src/containers/content/MeetupsContent/FilterBar/index.tsx

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

33
import type { TFiltersMenuItems } from '@/spec'
4-
import { ICON_CMD } from '@/config'
54

65
import { mockFilterMenuTags } from '@/utils/mock'
76

8-
import { Br } from '@/components/Common'
7+
import BrandTitle from '@/components/BrandTitle'
98
import Sticky from '@/components/Sticky'
109
import Button from '@/components/Buttons/Button'
1110
import FiltersMenu from '@/components/FiltersMenu'
1211
import DotDivider from '@/components/DotDivider'
1312

14-
import {
15-
Wrapper,
16-
MeetupIcon,
17-
LogoDesc,
18-
NaviFooter,
19-
Terms,
20-
TermItem,
21-
} from '../styles/filter_bar'
13+
import { Wrapper, NaviFooter, Terms, TermItem } from '../styles/filter_bar'
2214

2315
type TProps = {
2416
filtersItems: TFiltersMenuItems
@@ -28,9 +20,12 @@ const FilterBar: FC<TProps> = ({ filtersItems }) => {
2820
return (
2921
<Wrapper>
3022
<Sticky offsetTop={30}>
31-
<MeetupIcon src={`${ICON_CMD}/navi/meetup_logo.svg`} />
32-
<LogoDesc>来和志同道合的朋友们一起聊聊?</LogoDesc>
33-
<Br bottom={34} />
23+
<BrandTitle
24+
title="Meetup"
25+
fontSize={23}
26+
mBottom={30}
27+
desc="来和志同道合的朋友们一起聊聊?"
28+
/>
3429
<FiltersMenu tags={mockFilterMenuTags()} revert />
3530
<NaviFooter>
3631
<Button type="primary" size="small" ghost>

0 commit comments

Comments
 (0)