This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +87
-76
lines changed Expand file tree Collapse file tree 5 files changed +87
-76
lines changed Original file line number Diff line number Diff line change 44
55import React from 'react'
66
7+ import type { TCommunity } from '@/spec'
78import { cutRest } from '@/utils'
89
910import {
@@ -17,14 +18,7 @@ import {
1718} from './styles/community_card'
1819
1920type TProps = {
20- item : {
21- id : string
22- logo : string
23- title : string
24- raw : string
25- desc : string
26- subscribersCount : number
27- }
21+ item : TCommunity
2822}
2923
3024const CommunityCard : React . FC < TProps > = ( {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ import type { TCommunity } from '@/spec'
4+
5+ import Tooltip from '@/components/Tooltip'
6+ import CommunityCard from '@/components/Cards/CommunityCard'
7+
8+ import {
9+ Wrapper ,
10+ Title ,
11+ ListWrapper ,
12+ Community ,
13+ CommunityTitle ,
14+ } from './styles/community_recommends'
15+
16+ const tmpItems = [
17+ {
18+ id : '1' ,
19+ title : 'elixir' ,
20+ raw : 'elixir' ,
21+ logo : 'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/pl/elixir.png' ,
22+ desc :
23+ 'maybe the most popular UI framework for web, maybe the most popular UI framework for web' ,
24+ subscribersCount : 100 ,
25+ } ,
26+ {
27+ id : '2' ,
28+ title : 'javascript' ,
29+ raw : 'javascript' ,
30+ logo :
31+ 'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/pl/javascript.png' ,
32+ desc :
33+ 'maybe the most popular UI framework for web, maybe the most popular UI framework for web' ,
34+ subscribersCount : 100 ,
35+ } ,
36+ {
37+ id : '3' ,
38+ title : 'ruby' ,
39+ raw : 'ruby' ,
40+ logo : 'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/pl/ruby.png' ,
41+ desc :
42+ 'maybe the most popular UI framework for web, maybe the most popular UI framework for web' ,
43+ subscribersCount : 100 ,
44+ } ,
45+ {
46+ id : '4' ,
47+ title : 'clojure' ,
48+ raw : 'clojure' ,
49+ logo : 'https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/pl/clojure.png' ,
50+ desc :
51+ 'maybe the most popular UI framework for web, maybe the most popular UI framework for web' ,
52+ subscribersCount : 100 ,
53+ } ,
54+ ]
55+
56+ type TProps = {
57+ items ?: TCommunity [ ]
58+ }
59+
60+ const CommunityRecommends : React . FC < TProps > = ( { items = tmpItems } ) => {
61+ return (
62+ < Wrapper >
63+ < Title > 热门社区</ Title >
64+ < ListWrapper >
65+ { items . map ( ( item ) => (
66+ < Community key = { item . id } >
67+ { /* @ts -ignore */ }
68+ < Tooltip content = { < CommunityCard item = { item } /> } placement = "top" >
69+ < CommunityTitle > { item . title } </ CommunityTitle >
70+ </ Tooltip >
71+ </ Community >
72+ ) ) }
73+ </ ListWrapper >
74+ </ Wrapper >
75+ )
76+ }
77+
78+ export default React . memo ( CommunityRecommends )
Original file line number Diff line number Diff line change 11import styled from 'styled-components'
22
3- import Img from '@/Img'
43import { css } from '@/utils'
54
65export const Wrapper = styled . div `
@@ -13,8 +12,8 @@ export const Wrapper = styled.div`
1312`
1413export const Title = styled . div `
1514 font-size: 13px;
16- margin-bottom: 4px ;
17- opacity: 0;
15+ margin-bottom: 6px ;
16+ opacity: 0.8 ;
1817
1918 &:before {
2019 content: '- ';
@@ -40,7 +39,7 @@ export const ListWrapper = styled.div`
4039`
4140export const Community = styled . div `
4241 margin-right: 10px;
43- opacity: 0.7 ;
42+ opacity: 0.9 ;
4443
4544 &:hover {
4645 cursor: pointer;
@@ -56,10 +55,6 @@ export const Community = styled.div`
5655 margin-right: 12px;
5756 ` }
5857`
59- export const Logo = styled ( Img ) `
60- ${ css . size ( 18 ) } ;
61-
62- ${ css . media . mobile `
63- ${ css . size ( 16 ) } ;
64- ` }
58+ export const CommunityTitle = styled . span `
59+ font-size: 14px;
6560`
Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ export type TCommunity = {
5757 title : string
5858 logo ?: string
5959 raw : string
60- color ?: string
61- index ?: number
60+ subscribersCount ?: number
61+ desc ?: string
6262}
6363
6464export type TPagedCommunities = {
You can’t perform that action at this time.
0 commit comments