1.0.6 • Published 4 years ago

mastodon-share-button v1.0.6

Weekly downloads
131
License
MIT
Repository
github
Last release
4 years ago

Built With Stencil

Mastodon share button

This package is a user friendly web component to share in mastodon.

Browsers support

IE / EdgeFirefoxChromeSafariiOS SafariSamsung
IE11 (limited), Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versionslast 2 versions

View demos 👁

Preview

npm.io

Getting Started

Installation

Via CDN

<script src="https://unpkg.com/mastodon-share-button@latest/dist/mastodon-share-button.js"></script>

Via NPM

$ npm install mastodon-share-button 

Usage

<!-- Basic use -->
<mastodon-share-button share_message="Text to share"></mastodon-share-button>

<!-- Customized -->
<mastodon-share-button
    instances='["https://mastodon.eus", "https://mastodon.jalgi.eus"]'
    share_message="Text to share"
    share_button_text="Custom share button text"
    close_button_text="Custom close text"
    send_button_text="Custom send text"
    modal_title="Custom modal title"
    other_instance_text="Custom other instance select option text"
    dark_mode="true">
</mastodon-share-button>

Documentation

Properties

PropertyAttributeRequiredDescriptionTypeDefault
share_messageshare_messageRequiredText to share in mastodon.stringundefined
instancesinstancesNot RequiredList of instances to display in the select option.string'["https://mastodon.social"]'
dark_modedark_modeNot RequiredOption to activate dark mode.booleanfalse
send_button_textsend_button_textNot RequiredText to show at the bottom of sharing in the modal.string"Send"
icon_urlicon_urlNot RequiredIcon url. Put it "" to not display any icon.stringmastodon oficial logo
modal_titlemodal_titleNot RequiredTitle to display in modal.string"Share to Mastodon"
close_button_textclose_button_textNot RequiredText to display to close modal.string"Close"
other_instance_textother_instance_textNot RequiredText to display on the form.string"Other instance"
share_button_textshare_button_textNot RequiredText to show at the bottom of sharing. Put it "" to not display any text.string"Share to Mastodon"
openopenNot RequiredVariable to display the modal opened.booleanfalse

CSS Custom Properties (Styling)

The component could be styled with the help of CSS3 variables.

Example:

<style type="text/css">
  mastodon-share-button {
    --share-button-background-color:#259FFC;
    --share-button-background-color-hover:#C7E7FE;
  }
</style>
  • Important: If you are using the dark mode, you cannot apply any color variable, because this mode will overlap your css.

Share button

NameDescription
--share-button-background-colorShare button background color. Default to #cccccc
--share-button-background-color-hoverShare button background hover color. Default to #949292
--share-button-border-radiusDefault to 5px
--share-button-paddingDefault to 12px
--share-button-colorDefault to #ffffff
--share-button-font-sizeDefault to 16px
--share-button-font-weightDefault to bold
--share-button-borderDefaul to none

Modal

NameDescription
--modal-title-colorText color to modal title. Default to #2c3e50
--modal-background-colorModal background color. Default to #ffffff

Modal close button

NameDescription
--close-modal-button-background-colorClose button background color. Default to #cccccc
--close-modal-button-background-color-hoverShare button background hover color. Default to #949292
--close-modal-button-border-radiusDefault to 5px
--close-modal-button-paddingDefault to 6px
--close-modal-button-colorDefault to #ffffff
--close-modal-button-font-sizeDefault to 16px
--close-modal-button-font-weightDefault to bold
--close-modal-button-borderDefaul to none

Modal select option and input

NameDescription
--select-colorSelect and input font color. Default to #2c3e50
--select-background-colorSelect and input background color. Default to #ffffff
--select-borderSelect and input border. Default to 2px solid #2c3e50
--select-font-weightSelect and input font weight. Default to bolder
--select-font-sizeFont size. Default to 18px
--select-paddingDefault to 10px
--select-border-radiusDefault to 0.25em
--select-line-heightDefault to 3

Modal send button

NameDescription
--send-modal-button-colorDefault to #ffffff
--send-modal-button-background-colorDefault to #2692da
--send-modal-button-border-radiusDefault to 5px
--send-modal-button-widthDefault to 100%
--send-modal-button-heightDefault to 6vh
--send-modal-button-min-heightDefault to 42px
--send-modal-button-font-sizeDefault to 4vh
1.0.6

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago