Skip to content
Snippets Groups Projects
Select Git revision
  • d1d0bb2df8b38593d05ca425cbd490879bec6c08
  • main default protected
  • renovate/lock-file-maintenance
  • demo protected
  • person-select-custom
  • dbp-translation-component
  • icon-set-mapping
  • port-i18next-parser
  • remove-sentry
  • favorites-and-recent-files
  • revert-6c632dc6
  • lit2
  • advertisement
  • wc-part
  • automagic
  • publish
  • wip-cleanup
  • demo-file-handling
18 results

dbp-common-demo-activity.js

Blame
  • dbp-common-demo-activity.js 1.84 KiB
    import {css, html} from 'lit-element';
    import {ScopedElementsMixin} from '@open-wc/scoped-elements';
    import {DbpCommonDemo} from '@dbp-toolkit/common/dbp-common-demo';
    import * as commonUtils from '@dbp-toolkit/common/utils';
    import * as commonStyles from '@dbp-toolkit/common/styles';
    import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
    import readme from '@dbp-toolkit/common/README.md';
    import * as demoStyles from "./styles";
    import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
    
    class DbpCommonDemoActivity extends ScopedElementsMixin(AdapterLitElement) {
        constructor() {
            super();
            this.lang = 'en';
            this.entryPointUrl = '';
        }
    
        static get scopedElements() {
            return {
                'dbp-common-demo': DbpCommonDemo,
            };
        }
    
        static get properties() {
            return {
                ...super.properties,
                lang: { type: String },
                entryPointUrl: { type: String, attribute: 'entry-point-url' },
            };
        }
    
        connectedCallback() {
            super.connectedCallback();
    
            this.updateComplete.then(()=>{
            });
        }
    
        static get styles() {
            // language=css
            return [
                commonStyles.getThemeCSS(),
                commonStyles.getGeneralCSS(),
                demoStyles.getDemoCSS(),
                css`
                h1.title {margin-bottom: 1em;}
                div.container {margin-bottom: 1.5em;}
    
                #demo{
                    display: block;
                    padding-top: 50px;
                }
                
                `
            ];
        }
    
        render() {
            return html`
                    ${unsafeHTML(readme)}
                    <dbp-common-demo id="demo" lang="${this.lang}" entry-point-url="${this.entryPointUrl}"></dbp-common-demo>
            `;
        }
    }
    
    commonUtils.defineCustomElement('dbp-common-demo-activity', DbpCommonDemoActivity);