forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
142 additions
and
4 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/cxl-ui/scss/cxl-jw-player/cxl-jw-player-feedback-shadow.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host(:not([hidden])) { | ||
display: block; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/cxl-ui/scss/cxl-jw-player/cxl-jw-player-feedback.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host(:not([hidden])) { | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/cxl-ui/src/components/cxl-jw-player/cxl-jw-player-feedback/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { html, LitElement } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import style from '../../../styles/cxl-jw-player/cxl-jw-player-feedback-css'; | ||
import shadowStyle from '../../../styles/cxl-jw-player/cxl-jw-player-feedback-shadow-css'; | ||
|
||
@customElement('cxl-jw-player-feedback') | ||
export class CXLJWPlayerFeedbackElement extends LitElement { | ||
@property({ reflect: true, type: Boolean }) hidden = true; | ||
|
||
static get styles() { | ||
return [shadowStyle]; | ||
} | ||
|
||
render() { | ||
return html`<slot></slot>`; | ||
} | ||
|
||
async __setup() { | ||
await super.__setup(); | ||
|
||
this.__addStyle(style); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/cxl-ui/src/components/cxl-jw-player/mixins/feedback/index.html.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { html } from 'lit'; | ||
import '@vaadin/button'; | ||
import '@vaadin/icon'; | ||
|
||
// eslint-disable-next-line func-names | ||
export const feedbackTemplate = function () { | ||
return html`This is a sample feedback form.`; | ||
}; |
69 changes: 69 additions & 0 deletions
69
packages/cxl-ui/src/components/cxl-jw-player/mixins/feedback/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { html, render } from 'lit'; | ||
import { property } from 'lit/decorators.js'; | ||
import '../../../cxl-dialog/cxl-dialog'; | ||
|
||
export function FeedbackMixin(BaseClass) { | ||
class Mixin extends BaseClass { | ||
@property({ attribute: 'plugin-path', type: String }) pluginPath; | ||
|
||
__feedbackContent; | ||
|
||
__feedbackDialog; | ||
|
||
async __setupFeedback() { | ||
this.__feedbackContent = this.querySelector('cxl-jw-player-feedback'); | ||
|
||
/* eslint-disable no-param-reassign */ | ||
const headerRenderer = (root, dialog) => | ||
render( | ||
html` | ||
<vaadin-button | ||
theme="tertiary" | ||
@click="${() => { | ||
dialog.opened = false; | ||
}}" | ||
> | ||
<vaadin-icon icon="lumo:cross"></vaadin-icon> | ||
</vaadin-button> | ||
`, | ||
root | ||
); | ||
/* eslint-enable no-param-reassign */ | ||
|
||
const renderer = function (root) { | ||
root.appendChild(this.__feedbackContent); | ||
this.__feedbackContent.hidden = false; | ||
}.bind(this); | ||
|
||
render( | ||
html`<cxl-dialog | ||
contained | ||
.headerRenderer=${headerRenderer} | ||
.renderer=${renderer} | ||
header-title="Feedback" | ||
></cxl-dialog>`, | ||
this.__jwPlayerContainer | ||
); | ||
|
||
this.__jwPlayer.addButton( | ||
`<svg class="jw-player-button" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" aria-hidden="true" viewBox="0 0 1000 1000"><g><path d="M367 675H292v-258C292 325 366 250 459 250H458V208c0-23 18-42 42-41 23 0 42 18 42 41v42h-1C634 250 708 325 708 417V675h-75v-258c0-51-41-92-91-92h-84C408 325 367 366 367 417V675z m-159 37c0-21 17-38 38-37h508c21 0 37 17 38 37 0 21-17 38-38 38H246C225 750 208 733 208 713z m230 71h125v32c0 17-14 31-32 31h-62c-17 0-32-14-31-31v-32z"></path></g></svg>`, | ||
'Feedback', | ||
this.__toggleFeedback.bind(this), | ||
'toggle-feedback' | ||
); | ||
} | ||
|
||
async __setup() { | ||
await super.__setup(); | ||
|
||
this.__setupFeedback(); | ||
} | ||
|
||
__toggleFeedback() { | ||
const el = this.querySelector('.jwplayer').querySelector('cxl-dialog'); | ||
el.opened = !el.opened; | ||
} | ||
} | ||
|
||
return Mixin; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { BaseMixin } from './BaseMixin'; | ||
export { TranscriptMixin } from './TranscriptMixin'; | ||
export { ChapterNavigationMixin } from './chapter-navigation'; | ||
export { FeedbackMixin } from './feedback'; | ||
export { SavePositionMixin } from './SavePositionMixin'; |
21 changes: 21 additions & 0 deletions
21
packages/storybook/cxl-ui/cxl-jw-player/feedback.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { html } from 'lit'; | ||
import '@conversionxl/cxl-ui/src/components/cxl-jw-player/index.js'; | ||
import '@conversionxl/cxl-ui/src/components/cxl-jw-player/cxl-jw-player-feedback/index.js'; | ||
|
||
export default { | ||
title: 'CXL UI/cxl-jw-player', | ||
}; | ||
|
||
// eslint-disable-next-line no-empty-pattern | ||
const Template = ({}) => | ||
html` | ||
<style> | ||
#root-inner { | ||
height: 100vh; | ||
} | ||
</style> | ||
<cxl-jw-player-feedback>This is a feedback form</cxl-jw-player-feedback> | ||
`; | ||
|
||
export const Feedback = Template.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters