Skip to content

Commit 06bb0b3

Browse files
authored
Merge pull request #1 from codesyntax/1.0.6
1.0.6
2 parents 37a3233 + 0a3d153 commit 06bb0b3

File tree

5 files changed

+104
-34
lines changed

5 files changed

+104
-34
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mastodon-share-button",
3-
"version": "1.0.3",
3+
"version": "1.0.6",
44
"description": "Stencil Mastodon share button",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",
@@ -9,7 +9,7 @@
99
"types": "dist/types/index.d.ts",
1010
"collection": "dist/collection/collection-manifest.json",
1111
"collection:main": "dist/collection/index.js",
12-
"unpkg": "dist/mastodon-share/mastodon-share.js",
12+
"unpkg": "dist/mastodon-share-button/mastodon-share-button.js",
1313
"files": [
1414
"dist/",
1515
"loader/"
@@ -36,11 +36,14 @@
3636
"mastodon",
3737
"share",
3838
"button",
39-
"social"
39+
"social",
40+
"web component",
41+
"stencil",
42+
"stenciljs"
4043
],
4144
"author": "bipoza",
4245
"bugs": {
4346
"url": "https://github.com/codesyntax/mastodon-share-button/issues"
4447
},
45-
"homepage": "https://github.com/codesyntax/mastodon-social-button#readme"
48+
"homepage": "https://github.com/codesyntax/mastodon-share-button#readme"
4649
}

readme.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ This package is a user friendly web component to share in mastodon.
1010
| --------- | --------- | --------- | --------- | --------- | --------- |
1111
| IE11 *([limited](docs/ie.md))*, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
1212

13+
<br/>
14+
15+
# [View demos 👁](https://codepen.io/bipoza/pen/XWbegOM?editors=1100)
1316
# Preview
1417

1518
![](preview.gif)
@@ -18,7 +21,7 @@ This package is a user friendly web component to share in mastodon.
1821
## Installation
1922
### Via CDN
2023
```html
21-
<script src="https://unpkg.com/mastodon-share-button@1.0.0/dist/mastodon-share/mastodon-share.js"></script>
24+
<script src="https://unpkg.com/mastodon-share-button@latest/dist/mastodon-share-button/mastodon-share-button.js"></script>
2225
```
2326
### Via NPM
2427
```bash
@@ -46,21 +49,35 @@ $ npm install mastodon-share-button
4649
# Documentation
4750
## Properties
4851

49-
| Property | Attribute | Required | Type | Default |
50-
| --------------------- | --------------------- | ----------- | --------- | -------------------------------------------- |
51-
| `share_message` | `share_message` | Required | `string` | `undefined` |
52-
| `close_button_text` | `close_button_text` | Not Required | `string` | `"Close"` |
53-
| `dark_mode` | `dark_mode` | Not Required | `boolean` | `false` |
54-
| `icon_url` | `icon_url` | Not Required | `string` | `mastodon oficial logo` |
55-
| `instances` | `instances` | Not Required | `string` | `'["https://mastodon.social"]'` |
56-
| `modal_title` | `modal_title` | Not Required | `string` | `"Share to Mastodon"` |
57-
| `open` | `open` | Not Required | `boolean` | `false` |
58-
| `other_instance_text` | `other_instance_text` | Not Required | `string` | `"Other instance"` |
59-
| `send_button_text` | `send_button_text` | Not Required | `string` | `"Send"` |
60-
| `share_button_text` | `share_button_text` | Not Required | `string` | `"Share to Mastodon"` |
52+
| Property | Attribute | Required | Description | Type | Default |
53+
| --------------------- | --------------------- | ------------ | -------------------------------------------------- | -------- | -------------------------------- |
54+
| `share_message` | `share_message` | Required | Text to share in mastodon. |`string` | `undefined` |
55+
| `instances` | `instances` | Not Required | List of instances to display in the select option. |`string` | `'["https://mastodon.social"]'` |
56+
| `dark_mode` | `dark_mode` | Not Required | Option to activate dark mode. |`boolean` | `false` |
57+
| `send_button_text` | `send_button_text` | Not Required | Text to show at the bottom of sharing in the modal.|`string` | `"Send"` |
58+
| `icon_url` | `icon_url` | Not Required | Icon url. Put it "" to not display any icon. |`string` | `mastodon oficial logo` |
59+
| `modal_title` | `modal_title` | Not Required | Title to display in modal. |`string` | `"Share to Mastodon"` |
60+
| `close_button_text` | `close_button_text` | Not Required | Text to display to close modal. |`string` | `"Close"` |
61+
| `other_instance_text` | `other_instance_text` | Not Required | Text to display on the form. |`string` | `"Other instance"` |
62+
| `share_button_text` | `share_button_text` | Not Required | Text to show at the bottom of sharing. Put it "" to not display any text. |`string` | `"Share to Mastodon"` |
63+
| `open` | `open` | Not Required | Variable to display the modal opened. |`boolean` | `false` |
6164

6265
## CSS Custom Properties (Styling)
63-
* Important: If you are using the dark mode you will not be able to apply any color variable, because this mode will overlap the dark mode
66+
The component could be styled with the help of CSS3 variables.
67+
68+
Example:
69+
70+
```html
71+
<style type="text/css">
72+
mastodon-share-button {
73+
--share-button-background-color:#259FFC;
74+
--share-button-background-color-hover:#C7E7FE;
75+
}
76+
</style>
77+
```
78+
79+
* **Important**: If you are using the dark mode, you cannot apply any color variable, because this mode will overlap your css.
80+
6481
### Share button
6582
| Name | Description
6683
| ------------------------------- | --------------------------------------------------------------------|

src/components/mastodon-share-button/mastodon-share-button.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
display: flex;
6262
align-items: center;
6363
justify-content: center;
64+
z-index: 999;
6465
}
6566

6667
.is-visible {

src/components/mastodon-share-button/mastodon-share-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class MastodonShareButton {
7676

7777
<button onClick={() => this.openModal()} class="share-button">
7878
{this.share_button_text}
79-
<img src={this.icon_url} class={this.share_button_text.length!=0?"icon-with-text":""}/>
79+
{this.icon_url?<img src={this.icon_url} class={this.share_button_text.length!=0?"icon-with-text":""}/>:""}
8080
</button>
8181

8282
<div class={'overlay ' + (this.open ? 'is-visible' : '')} id="modal">

src/index.html

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,76 @@
99
<script type="module" src="/build/mastodon-share-button.esm.js"></script>
1010
<script nomodule src="/build/mastodon-share-button.js"></script>
1111
<!-- <link rel="stylesheet" href="/build/mastodon-share-button.css"> -->
12-
<style>
13-
.mastodon-button{
14-
--modal-background-color:red !important;
15-
/* --img-width:30px;
16-
--share-button-padding:10px;
17-
--share-button-border-radius:50%; */
18-
/* --button-color:red; */
19-
}
20-
21-
</style>
12+
<style>
13+
.round {
14+
--share-button-border-radius: 50%;
15+
}
16+
17+
.small {
18+
--img-width: 15px;
19+
--img-height: 15px;
20+
}
21+
22+
.blue-color {
23+
--share-button-background-color: #259FFC;
24+
--share-button-background-color-hover: #1e7fc9;
25+
}
26+
27+
.text-small {
28+
--share-button-font-size: 10px;
29+
--share-button-padding: 5px;
30+
--img-width: 12px;
31+
--img-height: 12px;
32+
}
33+
</style>
2234

2335
</head>
2436

2537
<body>
26-
<mastodon-share-button instances='["https://mastodon.eus", "https://mastodon.jalgi.eus"]' share_message="Aproba bat"
27-
share_button_text="Partekatu mastodonen" close_button_text="Itxi" send_button_text="Bidali" modal_title="Partekatu mastodonen"
28-
other_instance_text="Gehitu zure instantzia" dark_mode="true" class="mastodon-button">
38+
39+
<h2>Basic</h2>
40+
<mastodon-share-button share_message="Text to share"></mastodon-share-button>
41+
42+
<br>
43+
44+
<h2>Dark mode</h2>
45+
<mastodon-share-button share_message="Text to share" dark_mode="true"></mastodon-share-button>
46+
47+
<br />
48+
49+
<h2>Custom text</h2>
50+
<mastodon-share-button instances='["https://mastodon.eus", "https://mastodon.jalgi.eus"]'
51+
share_message="Text to share" share_button_text="Custom share button text" close_button_text="Custom close text"
52+
send_button_text="Custom send text" modal_title="Custom modal title"
53+
other_instance_text="Custom other instance select option text" dark_mode="true"></mastodon-share-button>
54+
55+
<br>
56+
57+
<h2>Custom formats</h2>
58+
<mastodon-share-button share_message="Text to share" share_button_text="" class="round"></mastodon-share-button>
59+
60+
<br>
61+
62+
<mastodon-share-button share_message="Text to share" icon_url=""></mastodon-share-button>
63+
64+
<br>
65+
66+
<h2>Custom color</h2>
67+
<mastodon-share-button share_message="Text to share" share_button_text="" class="round blue-color">
2968
</mastodon-share-button>
3069

31-
<!-- <mastodon-share-button >
32-
</mastodon-share-button> -->
70+
<h2>Custom image</h2>
71+
<mastodon-share-button share_message="Text to share" share_button_text=""
72+
icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Mastodon_First_Logo.svg/1200px-Mastodon_First_Logo.svg.png">
73+
</mastodon-share-button>
74+
75+
<h2>Custom size</h2>
76+
<mastodon-share-button share_message="Text to share" share_button_text="" class="round small blue-color">
77+
</mastodon-share-button>
78+
79+
<br>
80+
<mastodon-share-button share_message="Text to share" icon_url="" class="text-small blue-color">
81+
</mastodon-share-button>
3382

3483
</body>
3584

0 commit comments

Comments
 (0)