This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 12 files changed +89
-50
lines changed Expand file tree Collapse file tree 12 files changed +89
-50
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import Upvote from '@/components/Upvote'
55import DotDivider from '@/components/DotDivider'
66import IconText from '@/components/IconText'
77
8- import { Wrapper , PublishWrapper , Bottom } from '.. /styles/desktop_view /footer'
8+ import { Wrapper , PublishWrapper , Bottom } from './styles/footer'
99
1010const Footer : FC = ( ) => {
1111 return (
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type { TTag } from '@/spec'
44import { cutRest } from '@/utils'
55import InlineTags from '@/components/InlineTags'
66
7- import { Wrapper , Title } from '.. /styles/desktop_view /header'
7+ import { Wrapper , Title } from './styles/header'
88
99type TProps = {
1010 title : string
Original file line number Diff line number Diff line change 1+ import { FC , memo } from 'react'
2+
3+ import type { TJob } from '@/spec'
4+ // import { THREAD } from '@/constant'
5+
6+ import { cutRest } from '@/utils'
7+ import DigestSentence from '@/components/DigestSentence'
8+ import { Br , SpaceGrow } from '@/components/Common'
9+ import ArticleImgWindow from '@/components/ArticleImgWindow'
10+
11+ import Header from './Header'
12+ import Footer from './Footer'
13+
14+ import { Wrapper } from './styles'
15+ import { SIZE } from '@/constant'
16+
17+ type TProps = {
18+ data : TJob
19+ // thread?: TThread
20+ }
21+ const fakeDigest =
22+ '网络监测数据显示,从 7 月 12 日开始古巴限制了社交媒体和消息应用,此举被认为旨在限制信息流动。古巴上周末爆发了罕见的大规模反政府抗议。受到干扰的通讯平台包括了 WhatsApp、Facebook、Instagram 和部分 Telegram 服务。VPN 服务可以绕过这一干扰。古巴的反政府抗议与经济困难,疫苗短缺等问题有关。'
23+
24+ const ArticleCard : FC < TProps > = ( { data } ) => {
25+ const { title, tags } = data
26+
27+ return (
28+ < Wrapper >
29+ < Header title = { title } tags = { tags } />
30+ < Br top = { 15 } />
31+ < DigestSentence
32+ top = { 5 }
33+ bottom = { 15 }
34+ size = { SIZE . MEDIUM }
35+ onPreview = { ( ) => console . log ( 'send preview' ) }
36+ >
37+ { cutRest ( fakeDigest , 150 ) }
38+ </ DigestSentence >
39+ < Br top = { 4 } />
40+ < ArticleImgWindow />
41+ < Br top = { 16 } />
42+ < SpaceGrow />
43+ < Footer />
44+ </ Wrapper >
45+ )
46+ }
47+
48+ export default memo ( ArticleCard )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export const Wrapper = styled.div`
88export const PublishWrapper = styled . div `
99 ${ css . flex ( 'align-center' ) } ;
1010 margin-left: 3px;
11+ margin-bottom: 3px;
1112 font-size: 13px;
1213`
1314export const Bottom = styled . div `
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ // import React from 'react'
2+ // import { shallow } from 'enzyme'
3+
4+ // import ArticleCard from '../index'
5+
6+ describe ( 'TODO <ArticleCard />' , ( ) => {
7+ it ( 'Expect to have unit tests specified' , ( ) => {
8+ expect ( true ) . toEqual ( true )
9+ } )
10+ } )
Original file line number Diff line number Diff line change 66
77import { FC , ReactNode , memo } from 'react'
88
9+ import type { TSIZE_SM } from '@/spec'
10+ import { SIZE } from '@/constant'
911import { ICON } from '@/config'
1012import { buildLog } from '@/utils'
1113
@@ -31,6 +33,7 @@ type TProps = {
3133 bottom ?: number
3234 left ?: number
3335 right ?: number
36+ size ?: TSIZE_SM
3437 onPreview : ( ) => void
3538}
3639
@@ -42,6 +45,7 @@ const DigestSentence: FC<TProps> = ({
4245 bottom = 0 ,
4346 left = 0 ,
4447 right = 0 ,
48+ size = SIZE . SMALL ,
4549} ) => {
4650 return (
4751 < Wrapper
@@ -51,6 +55,7 @@ const DigestSentence: FC<TProps> = ({
5155 bottom = { bottom }
5256 left = { left }
5357 right = { right }
58+ size = { size }
5459 >
5560 { children }
5661 < Space left = { 8 } />
Original file line number Diff line number Diff line change 11import styled from 'styled-components'
22
3- import type { TTestable , TSpace } from '@/spec'
3+ import type { TTestable , TSpace , TSIZE_SM } from '@/spec'
44import Img from '@/Img'
55import { css , theme } from '@/utils'
66
7+ import { getFontSize } from './metric'
8+
9+ type TWrapper = TTestable & TSpace & { size : TSIZE_SM }
710export const Wrapper = styled . div . attrs ( ( { testid } : TTestable ) => ( {
811 'data-test-id' : testid ,
9- } ) ) < TTestable & TSpace > `
12+ } ) ) < TWrapper > `
1013 color: ${ theme ( 'thread.articleDigest' ) } ;
11- font-size: 13px ;
14+ font-size: ${ ( { size } ) => getFontSize ( size ) } ;
1215
1316 padding-top: ${ ( { top } ) => `${ top } px` } ;
1417 padding-bottom: ${ ( { bottom } ) => `${ bottom } px` } ;
Original file line number Diff line number Diff line change 1+ import type { TSIZE_SM } from '@/spec'
2+ import { SIZE } from '@/constant'
3+
4+ export const getFontSize = ( size : TSIZE_SM ) : string => {
5+ switch ( size ) {
6+ case SIZE . MEDIUM : {
7+ return '14px'
8+ }
9+
10+ default :
11+ return '13px'
12+ }
13+ }
14+
15+ export const holder = 1
You can’t perform that action at this time.
0 commit comments