Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitef6335d

Browse files
authored
feat(share): add telegram & article header (#1120)
* feat(share): add telegram share* refactor(share): add article title to header
1 parent2924915 commitef6335d

File tree

7 files changed

+49
-5
lines changed

7 files changed

+49
-5
lines changed
7.89 KB
Loading

‎src/containers/tool/Share/Platforms.tsx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import{FC,memo}from'react'
22

33
import{ICON}from'@/config'
4+
importtype{TArticle}from'@/spec'
45

56
import{SHARE_TYPE}from'./constant'
67
import{
78
Wrapper,
9+
Header,
10+
Hint,
11+
Article,
812
InnerWrapper,
913
Media,
1014
Logo,
@@ -51,6 +55,13 @@ const medias = [
5155
small:true,
5256
type:SHARE_TYPE.EMAIL,
5357
},
58+
{
59+
id:'5',
60+
title:'Telegram',
61+
logo:`${ICON}/social/telegram-share.png`,
62+
bg:'white',
63+
type:SHARE_TYPE.TELEGRAM,
64+
},
5465
{
5566
id:'6',
5667
title:'微博',
@@ -66,9 +77,18 @@ const medias = [
6677
},
6778
]
6879

69-
constPlatforms:FC=()=>{
80+
typeTProps={
81+
article:TArticle
82+
}
83+
84+
constPlatforms:FC<TProps>=({ article})=>{
7085
return(
7186
<Wrapper>
87+
<Header>
88+
<Hint>分享</Hint>
89+
<Article>{article.title}</Article>
90+
<Hint>到:</Hint>
91+
</Header>
7292
<InnerWrapper>
7393
{medias.map((item)=>(
7494
<Mediakey={item.id}onClick={()=>toPlatform(item.type)}>

‎src/containers/tool/Share/constant.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const OUTSIDE_SHARE_TYPE = {
88
TWITTER:'twitter',
99
EMAIL:'email',
1010
WECHAT:'wechat',
11+
TELEGRAM:'telegram',
1112
// QQ: 'qq',
1213
WEIBO:'weibo',
1314
FACEBOOK:'facebook',

‎src/containers/tool/Share/index.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ type TProps = {
2525

2626
constShareContainer:FC<TProps>=({share:store, testid})=>{
2727
useInit(store)
28-
const{ show, siteShareType, linksData}=store
28+
const{ show, siteShareType, linksData, viewingArticle}=store
2929

3030
return(
3131
<Fragment>
3232
<Modalwidth="450px"show={show}showCloseBtnonClose={close}>
3333
<Wrappertestid={testid}type={siteShareType}>
34-
<Platforms/>
34+
<Platformsarticle={viewingArticle}/>
3535
<InfoPaneltype={siteShareType}linksData={linksData}/>
3636
</Wrapper>
3737
</Modal>

‎src/containers/tool/Share/logic.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ export const toPlatform = (type: string): void => {
5252
// return openShareWindow('https://twitter.com/share', param)
5353
}
5454

55+
caseSHARE_TYPE.TELEGRAM:{
56+
constparam={ url,text:title}
57+
58+
returnopenShareWindow('https://telegram.me/share/url',param)
59+
}
60+
5561
caseSHARE_TYPE.EMAIL:{
5662
constparam={subject:title,body:`${url}\n\n${digest}`}
5763
returnopenShareWindow('mailto:',param)

‎src/containers/tool/Share/styles/platform.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,30 @@ import { css, theme } from '@/utils'
44
importImgfrom'@/Img'
55

66
exportconstWrapper=styled.div`
7-
padding: 20px 20px;
7+
padding-left: 20px;
8+
padding-right: 20px;
89
width: 100%;
910
min-height: 220px;
1011
background:${theme('modal.bg')};
1112
filter: drop-shadow(3px 3px 6px #002a34);
1213
transition: min-height 0.2s;
1314
`
15+
exportconstHeader=styled.div`
16+
${css.flex('align-end')};
17+
margin-top: 15px;
18+
padding-left: 25px;
19+
margin-bottom: 20px;
20+
`
21+
exportconstHint=styled.div`
22+
color:${theme('thread.articleDigest')};
23+
font-size: 13px;
24+
`
25+
exportconstArticle=styled.div`
26+
color:${theme('thread.articleTitle')};
27+
${css.cutRest('180px')};
28+
font-size: 14px;
29+
margin-left: 5px;
30+
`
1431
exportconstInnerWrapper=styled.div`
1532
${css.flex()};
1633
flex-wrap: wrap;

‎utils/css/media.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const mediaBreakPoints = {
1010
tablet:768,
1111
laptop:992,
1212
laptopM:1280,
13-
laptopL:1440,
13+
laptopL:1400,
1414
maxContent:1520,// WIDTH.COMMUNITY.PAGE
1515
desktop:1600,
1616
// currently used as forms of drawer content (slideout/modal)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp