From b5a7d83885e0bad505efa063b5ceab37b53a4357 Mon Sep 17 00:00:00 2001 From: suroh Date: Thu, 12 Oct 2023 11:44:20 +0200 Subject: [PATCH] updated modular player to have fixed columns --- src/components/ModularPlayer.js | 129 ++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/src/components/ModularPlayer.js b/src/components/ModularPlayer.js index 5912f43..95ec69b 100644 --- a/src/components/ModularPlayer.js +++ b/src/components/ModularPlayer.js @@ -176,9 +176,10 @@ class ModularPlayer extends LitElement { render() { - return html` -${ this.details ? - html`
+ return this.details ? html` +
+ + ${this.details.tracks ? html`
@@ -200,56 +201,65 @@ ${ this.details ?
` : html``} -
-

${this.details.tracks ? this.details?.tracks[this.track].title : this.details.title}

- ${this.details.tracks ? '' : html`

${this.details.details}

`} -
+ +
+ +
+

${this.details.tracks ? this.details?.tracks[this.track].title : this.details.title}

+ ${this.details.tracks ? '' : html`

${this.details.details}

`} +
-
- ${this._getTrack.render({ - complete: () => html` - ${formatSeconds(this.position)} + +
+ ${this._getTrack.render({ + complete: () => html` + ${formatSeconds(this.position)} - ${this.details?.tracks ? - html`` - : html` -
- - -
- ` - } + >` + : html` +
+ + +
+ ` + } - ${formatSeconds(this.duration)} - `, - error: (err) => err - })} + ${formatSeconds(this.duration)} + `, + error: (err) => err + })} - ${this.audio} -
- -
-
- - - - - + ${this.audio}
+ + +
+
+ + + + + +
+
+
- ` : ''}` + + ` + : '' } static styles = [ css`${unsafeCSS(MainCSS)}`, css` @@ -273,8 +283,7 @@ ${ this.details ? } .player:has(.tracklist) { - grid-template-rows: 67% 1fr 1fr 1fr; - padding-block-end: 2em; + grid-template-rows: 60% 40%; gap: 0; & > header { @@ -284,10 +293,38 @@ ${ this.details ? & .info { padding-block-end: 1.5em; } + + & .player-controls { + display: grid; + grid-template-rows: 5em repeat(2, 1fr); + padding: 1em; + + & header { + display: flex; + align-items: center; + justify-content: center; + text-align: center; + font-size: 1.3em; + } + } + } + + @container (min-width: 800px) { + header h2 { + color: pink; + background: red; + } } .player:has(.waveform) { - grid-template-rows: 0.7fr 0.7fr 1fr; + display: flex; + flex-direction: column; + + & .player-controls { + flex-grow: 1; + display: grid; + grid-template-rows: repeat(3, 1fr); + } & header { padding-block-start: 1em; @@ -307,8 +344,6 @@ ${ this.details ? } .tracklist + header { - text-align: center; - font-size: 1.25em; } .tracklist {