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

Commit c9eca37

Browse files
committed
refactor(jobviewer): ui: add homepage link & popver .. etc
1 parent ce3a663 commit c9eca37

File tree

5 files changed

+57
-11
lines changed

5 files changed

+57
-11
lines changed

components/ArticleHeader/CompanyInfo.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react'
22
import TimeAgo from 'timeago-react'
33

4+
import { ICON_CMD } from '../../config'
5+
46
import { DotDivider } from '..'
57

68
import {
@@ -9,6 +11,9 @@ import {
911
Title,
1012
PublishAt,
1113
Username,
14+
HomtPage,
15+
HomeIcon,
16+
HomepageLink,
1217
} from './styles/company_info'
1318

1419
import { cutFrom } from '../../utils'
@@ -18,6 +23,16 @@ const CompanyInfo = ({ company, insertedAt, author }) => (
1823
<Logo src={company.logo} alt="user_avatar" />
1924
<div>
2025
<Title>{cutFrom(company.title, 14)}</Title>
26+
<HomtPage>
27+
<HomeIcon src={`${ICON_CMD}/home.svg`} />
28+
<HomepageLink
29+
href="https://github.com"
30+
rel="noopener noreferrer"
31+
target="_blank"
32+
>
33+
https://github.com/mydearxym
34+
</HomepageLink>
35+
</HomtPage>
2136
<PublishAt>
2237
<Username>{author.nickname}</Username>
2338
<DotDivider />

components/ArticleHeader/styles/company_info.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ export const Title = styled.div`
1414
color: ${theme('thread.articleTitle')};
1515
margin-top: 2px;
1616
`
17+
export const HomtPage = styled.div`
18+
display: flex;
19+
align-items: center;
20+
`
21+
export const HomeIcon = styled(Img)`
22+
fill: ${theme('thread.articleDigest')};
23+
width: 15px;
24+
height: 15px;
25+
display: block;
26+
`
27+
export const HomepageLink = styled.a`
28+
color: ${theme('thread.articleDigest')};
29+
margin-left: 3px;
30+
&:hover {
31+
text-decoration: underline;
32+
color: ${theme('thread.articleTitle')};
33+
}
34+
`
1735
export const Username = styled.div`
1836
font-size: 0.9rem;
1937
`
@@ -25,7 +43,7 @@ export const PublishAt = styled.div`
2543
`
2644
export const Logo = styled(Img)`
2745
border-radius: 3px;
28-
width: 44px;
29-
height: 44px;
30-
margin-right: 10px;
46+
width: 64px;
47+
height: 64px;
48+
margin-right: 12px;
3149
`

containers/Labeler/Selected.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import R from 'ramda'
33

44
import { Maybe } from '../../components'
55
import { Wrapper, Item, Hightlight } from './styles/selected'
6+
import { uid } from '../../utils'
67

78
const renderItems = items => {
89
if (items.length === 1) {
@@ -31,7 +32,9 @@ const renderReadonlyItems = items => {
3132

3233
return (
3334
<Item>
34-
<Hightlight>{items[0]}, ..</Hightlight>
35+
{items.map(item => (
36+
<Hightlight key={uid.gen()}>{item}</Hightlight>
37+
))}
3538
</Item>
3639
)
3740
}

containers/Labeler/index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { inject, observer } from 'mobx-react'
1212
import { Popover, Maybe } from '../../components'
1313
import Options from './Options'
1414
import Selected from './Selected'
15-
import { Wrapper, LabelItem, LabelIcon, Title } from './styles'
15+
import { Wrapper, LabelItem, LabelIcon, Title, PopHint } from './styles'
1616

1717
import optionMap from './option_map'
1818
import { makeDebugger, storePlug, uid } from '../../utils'
@@ -64,12 +64,18 @@ class LabelerContainer extends React.Component {
6464
return (
6565
<Wrapper>
6666
<Maybe test={readonly}>
67-
<LabelItem>
68-
<LabelIcon src={optionMap[label].iconSrc} />
69-
<Title>
70-
<Selected items={selected} readonly={readonly} />
71-
</Title>
72-
</LabelItem>
67+
<Popover
68+
content={<PopHint>{trans[label]}</PopHint>}
69+
placement="bottom"
70+
trigger="hover"
71+
>
72+
<LabelItem>
73+
<LabelIcon src={optionMap[label].iconSrc} />
74+
<Title>
75+
<Selected items={selected} readonly={readonly} />
76+
</Title>
77+
</LabelItem>
78+
</Popover>
7379
</Maybe>
7480
<Maybe test={!readonly}>
7581
{targetIndex >= 0 ? (

containers/Labeler/styles/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ export const Title = styled.div`
3434
color: ${theme('editor.footerHover')};
3535
}
3636
`
37+
export const PopHint = styled.div`
38+
padding: 5px 8px;
39+
color: ${theme('thread.articleDigest')};
40+
`

0 commit comments

Comments
 (0)