Sha256: 974b43d4fac52b9d2b0301bec32a0d0cc913a8a4a782b5d214f5065082882e1f

Contents?: true

Size: 812 Bytes

Versions: 94

Compression:

Stored size: 812 Bytes

Contents

import {controller, target} from '@github/catalyst'

@controller
class XBannerElement extends HTMLElement {
  @target titleText: HTMLElement

  dismiss() {
    const parentElement = this.parentElement
    if (!parentElement) return

    if (this.#dismissScheme === 'remove') {
      parentElement.removeChild(this)
    } else {
      this.hide()
    }
  }

  show() {
    this.style.setProperty('display', 'initial')
  }

  hide() {
    this.style.setProperty('display', 'none')
  }

  get #dismissScheme(): string {
    return this.getAttribute('data-dismiss-scheme')!
  }
}

declare global {
  interface Window {
    XBannerElement: typeof XBannerElement
  }
}

if (!window.customElements.get('x-banner')) {
  window.XBannerElement = XBannerElement
  window.customElements.define('x-banner', XBannerElement)
}

Version data entries

94 entries across 94 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.44.3 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.44.2 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.44.1 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.44.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.43.1 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.43.0 app/components/primer/alpha/x_banner.ts
primer_view_components-0.32.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.42.0 app/components/primer/alpha/x_banner.ts
primer_view_components-0.31.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.41.1 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.41.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.40.0 app/components/primer/alpha/x_banner.ts
primer_view_components-0.30.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.39.1 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.39.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.38.0 app/components/primer/alpha/x_banner.ts
primer_view_components-0.29.0 app/components/primer/alpha/x_banner.ts
primer_view_components-0.28.0 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.37.1 app/components/primer/alpha/x_banner.ts
openproject-primer_view_components-0.37.0 app/components/primer/alpha/x_banner.ts