diff --git a/src/index.js b/src/index.js index b6703d6..84a4222 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,7 @@ import './layout/content/lists/lists-page'; import './layout/content/search/search-page'; import './layout/content/settings/settings-page'; import './layout/content/showcase/showcase-page'; -import './layout/header/header-component'; +import './layout/header/demo-header-component.js'; import './router/route-outlet-component'; import router from './router/router'; import PreferencesProvider from './layout/content/settings/preferences-provider'; diff --git a/src/layout/header/core-demo-header-component.js b/src/layout/header/core-demo-header-component.js new file mode 100644 index 0000000..085e8ed --- /dev/null +++ b/src/layout/header/core-demo-header-component.js @@ -0,0 +1,44 @@ +import githubLogoSvg from '../../../img/github-logo.svg?raw'; +import srgssrLogo from '../../../img/srgssr-logo.png'; +import { html, LitElement, unsafeCSS } from 'lit'; +import { unsafeSVG } from 'lit/directives/unsafe-svg.js'; +import '../../router/route-link-component'; +import { theme } from '../../theme/theme'; +import coreHeaderCss from './core-demo-header-component.scss?inline'; + +/** + * A web component that represents the header element of the demo page. This element + * contains only the branding and a link to the GitHub page, it can be extended + * with a custom action. + * + * @element core-demo-header + * + * @slot actions - Allows for the insertion of custom content at the end of the header. + * + * @example + * + * + * + */ +export class CoreDemoHeaderComponent extends LitElement { + static styles = [theme, unsafeCSS(coreHeaderCss)]; + + render() { + return html` +
+

+ + Pillarbox +

+
+ + ${unsafeSVG(githubLogoSvg)} + + +
+
`; + } +} + +customElements.define('core-demo-header', CoreDemoHeaderComponent); diff --git a/src/layout/header/core-demo-header-component.scss b/src/layout/header/core-demo-header-component.scss new file mode 100644 index 0000000..8e6cf21 --- /dev/null +++ b/src/layout/header/core-demo-header-component.scss @@ -0,0 +1,36 @@ +header { + display: flex; + align-items: baseline; + justify-content: space-between; + width: 100%; + margin: var(--size-4) 0; +} + +h1 { + display: flex; + gap: .15em; + align-items: center; + margin: 0; +} + +.pbw-logo { + height: var(--size-7); +} + +.github-link { + display: flex; + align-items: center; +} + +.github-icon { + fill: var(--color-5); + + &:hover { + fill: var(--color-2); + } +} + +.header-end { + display: flex; + align-items: center; +} diff --git a/src/layout/header/header-component.js b/src/layout/header/demo-header-component.js similarity index 66% rename from src/layout/header/header-component.js rename to src/layout/header/demo-header-component.js index c98d9ac..d22f97f 100644 --- a/src/layout/header/header-component.js +++ b/src/layout/header/demo-header-component.js @@ -1,16 +1,21 @@ -import githubLogoSvg from '../../../img/github-logo.svg?raw'; -import srgssrLogo from '../../../img/srgssr-logo.png'; import { html, LitElement, unsafeCSS } from 'lit'; -import { unsafeSVG } from 'lit/directives/unsafe-svg.js'; import '../../router/route-link-component'; import { theme } from '../../theme/theme'; -import headerCSS from './header-component.scss?inline'; +import headerCSS from './demo-header-component.scss?inline'; import router from '../../router/router'; +import './core-demo-header-component.js'; /** - * A web component that represents the header element of the demo page. + * A web component that represents the header of the demo page. This header contains + * the {@link CoreDemoHeaderComponent} as well as the navigation menu of the + * different demo app sections. * - * @element pbw-header + * @element demo-header + * + * @prop {Boolean} debug - Indicates whether the debug mode is enabled. + * + * @example + * */ export class DemoHeaderElement extends LitElement { static properties = { @@ -45,22 +50,13 @@ export class DemoHeaderElement extends LitElement { #renderHeaderElement() { return html` -
-

- - Pillarbox -

-
- - ${unsafeSVG(githubLogoSvg)} - - - settings - -
-
`; + + + settings + + + `; } #renderNavElement() { diff --git a/src/layout/header/header-component.scss b/src/layout/header/demo-header-component.scss similarity index 59% rename from src/layout/header/header-component.scss rename to src/layout/header/demo-header-component.scss index 5074847..0551ac5 100644 --- a/src/layout/header/header-component.scss +++ b/src/layout/header/demo-header-component.scss @@ -8,45 +8,6 @@ li { display: inline-block; } -header { - display: flex; - align-items: baseline; - justify-content: space-between; - margin: var(--size-4) 0; - - h1 { - display: flex; - gap: .15em; - align-items: center; - margin: 0; - } -} - -.pbw-logo { - height: var(--size-7); -} - -.version-txt { - align-self: flex-end; - color: var(--color-6); - font-weight: var(--font-weight-4); - font-size: var(--size-3); - line-height: var(--size-5); -} - -.github-link { - display: flex; - align-items: center; -} - -.github-icon { - fill: var(--color-5); - - &:hover { - fill: var(--color-2); - } -} - route-link::part(a) { padding: var(--size-1) var(--size-1); font-size: var(--size-4); @@ -62,7 +23,7 @@ route-link::part(a active) { transition: background-color 0.8s, color 0.4s; } -.header-end { +core-demo-header { display: flex; align-items: center; diff --git a/static/showcases/multi-player.html b/static/showcases/multi-player.html index bcdeb00..55dc356 100644 --- a/static/showcases/multi-player.html +++ b/static/showcases/multi-player.html @@ -10,6 +10,7 @@ +

Multiple players

@@ -48,6 +49,7 @@

Multiple players