-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal Dialog #2668
Modal Dialog #2668
Changes from all commits
bc5be3e
7e788c5
aa86bea
b14fb8a
0575a81
a178f5c
5041d8e
46a178d
a617e49
b22f6a0
d8edb19
bc84666
06ea1ca
be7fb74
6a4ac48
855d590
7fb0166
a556447
1bf9d4c
467affd
5e652b4
b372694
370e2bc
be00345
ca80d0a
fc8cc9a
c47b8f9
fdfd809
e97399c
06e942f
a7def7c
fa16f3d
02947ed
cd48015
d786867
5e94d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.video-js .vjs-control.vjs-close-button { | ||
@extend .vjs-icon-cancel; | ||
cursor: pointer; | ||
height: 3em; | ||
position: absolute; | ||
right: 0; | ||
top: 0.5em; | ||
z-index: 2; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,23 @@ | ||
.vjs-error-display { | ||
display: none; | ||
} | ||
|
||
.vjs-error .vjs-error-display { | ||
display: block; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
width: 100%; | ||
height: 100%; | ||
.vjs-error .vjs-error-display .vjs-modal-dialog-content { | ||
font-size: 1.4em; | ||
text-align: center; | ||
} | ||
|
||
.vjs-error .vjs-error-display:before { | ||
color: #fff; | ||
content: 'X'; | ||
font-family: $text-font-family; | ||
font-size: 4em; | ||
color: #fff; | ||
/* In order to center the play icon vertically we need to set the line height | ||
to the same as the button height */ | ||
line-height: 1; | ||
text-shadow: 0.05em 0.05em 0.1em #000; | ||
text-align: center /* Needed for IE8 */; | ||
vertical-align: middle; | ||
left: 0; | ||
|
||
// In order to center the play icon vertically we need to set the line height | ||
// to the same as the button height | ||
line-height: 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this removed on purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. It looked totally broken with that style - it duplicates a lot of the style of the modal dialog. I don't know what the "X" was about (I was guessing a "close" icon/button). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think just to signify an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, then I'll bring that back. |
||
margin-top: -0.5em; | ||
position: absolute; | ||
left: 0; | ||
text-shadow: 0.05em 0.05em 0.1em #000; | ||
text-align: center; // Needed for IE8 | ||
top: 50%; | ||
margin-top: -0.5em; | ||
vertical-align: middle; | ||
width: 100%; | ||
} | ||
|
||
.vjs-error-display div { | ||
position: absolute; | ||
bottom: 1em; | ||
right: 0; | ||
left: 0; | ||
font-size: 1.4em; | ||
text-align: center; | ||
padding: 3px; | ||
|
||
@include background-color-with-alpha(#000, 0.5); | ||
} | ||
|
||
.vjs-error-display a, | ||
.vjs-error-display a:visited { | ||
color: #66A8CC; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.video-js .vjs-modal-dialog { | ||
@extend %fill-parent; | ||
@include linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0)); | ||
} | ||
|
||
.vjs-modal-dialog .vjs-modal-dialog-content { | ||
@extend %fill-parent; | ||
|
||
font-size: 1.2em; // 12px | ||
line-height: 1.5; // 18px | ||
padding: 30px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should probably be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the same thing originally (was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. Also, |
||
z-index: 1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// These functions and mixins taken from: | ||
// | ||
// "Building a linear-gradient Mixin in Sass" by Hugo Giraudel | ||
// http://www.sitepoint.com/building-linear-gradient-mixin-sass/ | ||
// http://sassmeister.com/gist/b58f6e2cc3160007c880 | ||
// | ||
|
||
/// Convert angle | ||
/// @author Chris Eppstein | ||
/// @param {Number} $value - Value to convert | ||
/// @param {String} $unit - Unit to convert to | ||
/// @return {Number} Converted angle | ||
@function convert-angle($value, $unit) { | ||
$convertable-units: deg grad turn rad; | ||
$conversion-factors: 1 (10grad/9deg) (1turn/360deg) (3.1415926rad/180deg); | ||
@if index($convertable-units, unit($value)) and index($convertable-units, $unit) { | ||
@return $value | ||
/ nth($conversion-factors, index($convertable-units, unit($value))) | ||
* nth($conversion-factors, index($convertable-units, $unit)); | ||
} | ||
|
||
@warn "Cannot convert `#{unit($value)}` to `#{$unit}`."; | ||
} | ||
|
||
/// Test if `$value` is an angle | ||
/// @param {*} $value - Value to test | ||
/// @return {Bool} | ||
@function is-direction($value) { | ||
$is-direction: index(( | ||
'to top', | ||
'to top right', | ||
'to right top', | ||
'to right', | ||
'to bottom right', | ||
'to right bottom', | ||
'to bottom', | ||
'to bottom left', | ||
'to left bottom', | ||
'to left', | ||
'to left top', | ||
'to top left' | ||
), $value); | ||
$is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value)); | ||
|
||
@return $is-direction or $is-angle; | ||
} | ||
|
||
/// Convert a direction to legacy syntax | ||
/// @param {Keyword | Angle} $value - Value to convert | ||
/// @require {function} is-direction | ||
/// @require {function} convert-angle | ||
@function legacy-direction($value) { | ||
@if is-direction($value) == false { | ||
@warn "Cannot convert `#{$value}` to legacy syntax because it doesn't seem to be an angle or a direction"; | ||
} | ||
|
||
$conversion-map: ( | ||
'to top' : 'bottom', | ||
'to top right' : 'bottom left', | ||
'to right top' : 'left bottom', | ||
'to right' : 'left', | ||
'to bottom right' : 'top left', | ||
'to right bottom' : 'left top', | ||
'to bottom' : 'top', | ||
'to bottom left' : 'top right', | ||
'to left bottom' : 'right top', | ||
'to left' : 'right', | ||
'to left top' : 'right bottom', | ||
'to top left' : 'bottom right' | ||
); | ||
|
||
@if map-has-key($conversion-map, $value) { | ||
@return map-get($conversion-map, $value); | ||
} | ||
|
||
@return 90deg - convert-angle($value, 'deg'); | ||
} | ||
|
||
/// Mixin printing a linear-gradient | ||
/// as well as a plain color fallback | ||
/// and the `-webkit-` prefixed declaration | ||
/// @access public | ||
/// @param {String | List | Angle} $direction - Linear gradient direction | ||
/// @param {Arglist} $color-stops - List of color-stops composing the gradient | ||
@mixin linear-gradient($direction, $color-stops...) { | ||
@if is-direction($direction) == false { | ||
$color-stops: ($direction, $color-stops); | ||
$direction: 180deg; | ||
} | ||
|
||
background: nth(nth($color-stops, 1), 1); | ||
background: -webkit-linear-gradient(legacy-direction($direction), $color-stops); | ||
background: linear-gradient($direction, $color-stops); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Button from './button'; | ||
import Component from './component'; | ||
|
||
/** | ||
* The `CloseButton` component is a button which fires a "close" event | ||
* when it is activated. | ||
* | ||
* @extends Button | ||
* @class CloseButton | ||
*/ | ||
class CloseButton extends Button { | ||
|
||
constructor(player, options) { | ||
super(player, options); | ||
this.controlText(options && options.controlText || this.localize('Close')); | ||
} | ||
|
||
buildCSSClass() { | ||
return `vjs-close-button ${super.buildCSSClass()}`; | ||
} | ||
|
||
handleClick() { | ||
this.trigger({type: 'close', bubbles: false}); | ||
} | ||
} | ||
|
||
Component.registerComponent('CloseButton', CloseButton); | ||
export default CloseButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,53 +2,58 @@ | |
* @file error-display.js | ||
*/ | ||
import Component from './component'; | ||
import * as Dom from './utils/dom.js'; | ||
import ModalDialog from './modal-dialog'; | ||
|
||
import * as Dom from './utils/dom'; | ||
import mergeOptions from './utils/merge-options'; | ||
|
||
/** | ||
* Display that an error has occurred making the video unplayable | ||
* Display that an error has occurred making the video unplayable. | ||
* | ||
* @param {Object} player Main Player | ||
* @param {Object=} options Object of option names and values | ||
* @extends Component | ||
* @extends ModalDialog | ||
* @class ErrorDisplay | ||
*/ | ||
class ErrorDisplay extends Component { | ||
class ErrorDisplay extends ModalDialog { | ||
|
||
/** | ||
* Constructor for error display modal. | ||
* | ||
* @param {Player} player | ||
* @param {Object} [options] | ||
*/ | ||
constructor(player, options) { | ||
super(player, options); | ||
|
||
this.update(); | ||
this.on(player, 'error', this.update); | ||
this.on(player, 'error', this.open); | ||
} | ||
|
||
/** | ||
* Create the component's DOM element | ||
* Include the old class for backward-compatibility. | ||
* | ||
* @return {Element} | ||
* @method createEl | ||
* This can be removed in 6.0. | ||
* | ||
* @method buildCSSClass | ||
* @deprecated | ||
* @return {String} | ||
*/ | ||
createEl() { | ||
var el = super.createEl('div', { | ||
className: 'vjs-error-display' | ||
}); | ||
|
||
this.contentEl_ = Dom.createEl('div'); | ||
el.appendChild(this.contentEl_); | ||
|
||
return el; | ||
buildCSSClass() { | ||
return `vjs-error-display ${super.buildCSSClass()}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. completely not relevant to this PR but wouldn't it be awesome if Component did the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly. My concern with that sort of implicit behavior is that it's hard to override if you don't want it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be a separate method. mixinCSSClass() {
return 'vjs-error-display'; // gets combined with superclass classNames
}
buildCSSClass() {
return 'vjs-error-display'; // overrides, identical behavior to today
} Of course, it doesn't look like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, maybe a separate method. Anyway, completely separate from this PR :) |
||
} | ||
|
||
/** | ||
* Update the error message in localized language | ||
* Generates the modal content based on the player error. | ||
* | ||
* @method update | ||
* @return {String|Null} | ||
*/ | ||
update() { | ||
if (this.player().error()) { | ||
this.contentEl_.innerHTML = this.localize(this.player().error().message); | ||
} | ||
content() { | ||
let error = this.player().error(); | ||
return error ? this.localize(error.message) : ''; | ||
} | ||
} | ||
|
||
ErrorDisplay.prototype.options_ = mergeOptions(ModalDialog.prototype.options_, { | ||
fillAlways: true, | ||
uncloseable: true | ||
}); | ||
|
||
Component.registerComponent('ErrorDisplay', ErrorDisplay); | ||
export default ErrorDisplay; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any ideas why github could be complaining about this property name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I noticed that. It's standard, though: https://drafts.csswg.org/css-flexbox-1/#order-property