import { h, Host } from "@stencil/core";
import { translations } from "./translations";
const SHARE_URLS = [
    { platform: 'linkedin', url: 'https://www.linkedin.com/sharing/share-offsite/?url=', text: 'LinkedIn' },
    { platform: 'twitter', url: 'https://twitter.com/intent/tweet?url=', text: 'Twitter' },
    { platform: 'facebook', url: 'https://www.facebook.com/sharer/sharer.php?u=', text: 'Facebook' },
];
export class PnShare {
    constructor() {
        this.link = null;
        this.language = 'sv';
        this.i18n = undefined;
    }
    hostElement;
    componentWillLoad() {
        this.setTranslations();
    }
    setTranslations() {
        if (this.language === 'nb') {
            this.language = 'no';
        }
        if (this.language && translations[this.language]) {
            this.i18n = translations[this.language];
        }
    }
    onLanguageChange() {
        this.setTranslations();
    }
    render() {
        return (h(Host, { key: '87c86e64bc6e31b8ecb1f172005dc1fa2b2a821a' }, h("div", { key: 'b0ae9877a73c5b2a67a6fc03e91cae21062df823', class: "pn-share__container" }, h("h3", { key: 'b410f35c7a3e20951b6795c886e755d4c9cc6337', class: "pn-share__heading" }, this.i18n.sharelabel, ":"), h("div", { key: 'e5b84fdc21fb4fcd5de996f55ef2b689d3385f80', class: "pn-share__items" }, SHARE_URLS.map(platform => {
            return (h("pn-share-item", { link: `${platform.url}${this.link}`, text: platform.text }, h("pn-icon", { slot: "icon", icon: platform.platform })));
        })))));
    }
    static get is() { return "pn-share"; }
    static get originalStyleUrls() {
        return {
            "$": ["pn-share.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["pn-share.css"]
        };
    }
    static get properties() {
        return {
            "link": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "link",
                "reflect": false,
                "defaultValue": "null"
            },
            "language": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "language",
                "reflect": true,
                "defaultValue": "'sv'"
            }
        };
    }
    static get states() {
        return {
            "i18n": {}
        };
    }
    static get elementRef() { return "hostElement"; }
    static get watchers() {
        return [{
                "propName": "language",
                "methodName": "onLanguageChange"
            }];
    }
}
//# sourceMappingURL=pn-share.js.map
