Skip to content

Commit 71e8ade

Browse files
committed
➕ WorkplaceShareButton
1 parent e8b84f2 commit 71e8ade

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Social media share buttons for your next React apps.
2424
* Linkedin
2525
* VKShare
2626
* Livejournal
27+
* Workplace
2728

2829
## 🔧 Install
2930

@@ -252,6 +253,22 @@ import {
252253
</LivejournalShareButton>
253254
```
254255

256+
### 🎀 Workplace
257+
258+
```js
259+
import {
260+
WorkplaceShareButton,
261+
WorkplaceIcon,
262+
} from 'next-share'
263+
264+
<WorkplaceShareButton
265+
url={'https://github.com/next-share'}
266+
quote={'Next Share'}
267+
>
268+
<WorkplaceIcon size={32} round />
269+
</WorkplaceShareButton>
270+
```
271+
255272
## 📚 Icons Documentation
256273

257274
### 📖 Icons Props
@@ -1033,6 +1050,60 @@ import {
10331050
</tr>
10341051
</table>
10351052

1053+
### 📖 LivejournalShareButton Props
1054+
1055+
<table>
1056+
<tr>
1057+
<th>Props</th>
1058+
<th>Type</th>
1059+
<th>Default</th>
1060+
<th>Description</th>
1061+
<th>Required</th>
1062+
</tr>
1063+
<tr>
1064+
<td>children</td>
1065+
<td>React node</td>
1066+
<td></td>
1067+
<td>React component, HTML element or string.</td>
1068+
<td>✅</td>
1069+
</tr>
1070+
<tr>
1071+
<td>url</td>
1072+
<td>string</td>
1073+
<td></td>
1074+
<td>The URL of the shared page.</td>
1075+
<td>✅</td>
1076+
</tr>
1077+
<tr>
1078+
<td>quote</td>
1079+
<td>string</td>
1080+
<td></td>
1081+
<td>A quote to be shared along with the link.</td>
1082+
<td>❌</td>
1083+
</tr>
1084+
<tr>
1085+
<td>hashtag</td>
1086+
<td>string</td>
1087+
<td></td>
1088+
<td> A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol.</td>
1089+
<td>❌</td>
1090+
</tr>
1091+
<tr>
1092+
<td>windowWidth</td>
1093+
<td>number</td>
1094+
<td>550</td>
1095+
<td>Opened window width.</td>
1096+
<td>❌</td>
1097+
</tr>
1098+
<tr>
1099+
<td>windowHeight</td>
1100+
<td>number</td>
1101+
<td>400</td>
1102+
<td>Opened window height.</td>
1103+
<td>❌</td>
1104+
</tr>
1105+
</table>
1106+
10361107
## 💖 Wrap Up
10371108

10381109
If you think any of the `next-share` can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

examples/javascript/src/App.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {
2828
MailruIcon,
2929
LivejournalShareButton,
3030
LivejournalIcon,
31+
WorkplaceShareButton,
32+
WorkplaceIcon
3133
} from 'next-share'
3234

3335
function App() {
@@ -153,6 +155,12 @@ function App() {
153155
<LivejournalIcon size={32} round />
154156
</div>
155157
</LivejournalShareButton>
158+
<WorkplaceShareButton
159+
url={'https://github.com/next-share'}
160+
quote={'Next Share'}
161+
>
162+
<WorkplaceIcon size={32} round />
163+
</WorkplaceShareButton>
156164
</div>
157165
)
158166
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import transformObjectToParams from '../../utils';
2+
import createShareButton from '../../hocs/createShareButton';
3+
4+
function workplaceLink(
5+
url: string,
6+
{ quote, hashtag }: { quote?: string; hashtag?: string },
7+
) {
8+
return (
9+
'https://work.facebook.com/sharer.php' +
10+
transformObjectToParams({
11+
u: url,
12+
quote,
13+
hashtag,
14+
})
15+
);
16+
}
17+
18+
const WorkplaceShareButton = createShareButton<{
19+
quote?: string;
20+
hashtag?: string;
21+
}>(
22+
'workplace',
23+
workplaceLink,
24+
(props) => ({
25+
quote: props.quote,
26+
hashtag: props.hashtag,
27+
}),
28+
{
29+
windowWidth: 550,
30+
windowHeight: 400,
31+
},
32+
);
33+
34+
export default WorkplaceShareButton;

src/next-share.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ export { default as LinkedinShareButton } from './components/buttons/LinkedinSha
3030
export { default as VKShareButton } from './components/buttons/VKShareButton';
3131
export { default as MailruShareButton } from './components/buttons/MailruShareButton';
3232
export { default as LivejournalShareButton } from './components/buttons/LivejournalShareButton';
33+
export { default as WorkplaceShareButton } from './components/buttons/WorkplaceShareButton';

0 commit comments

Comments
 (0)