Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ module.exports = {
'new-cap': [2, {
newIsCapExceptionPattern: "Ctor$",
}],
'require-jsdoc': 0,
},
};
2 changes: 1 addition & 1 deletion src/breakpoints/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block title %}Airkit2 - breakpoints{% endblock %}

{% block head_scripts %}
{% block styles %}
{{macros.style_tag('breakpoints/breakpoints.example.min.css')}}
{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions src/docs/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ <h2>Components</h2>
<ul>
<li><a href="/airkit2/inview/">InviewComponent</a></li>
<li><a href="/airkit2/lazyimage/">LazyImageComponent</a></li>
<li><a href="/airkit2/ytmodal/">YTModalComponent</a></li>
</ul>

<h2>SASS Modules</h2>
Expand Down
40 changes: 40 additions & 0 deletions src/utils/useragent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export function isMobile() {
return isIOS() || isAndroid();
}


export function isIOS() {
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
}


export function isAndroid() {
return /Android/i.test(navigator.userAgent);
}


export function isChrome() {
return navigator.userAgent.indexOf('Chrome') != -1;
}


export function isSafari() {
return !isChrome() && navigator.userAgent.indexOf('Safari') != -1;
}


export function isFirefox() {
return navigator.userAgent.indexOf('Firefox') != -1;
}


export function isIE() {
return /MSIE\/\d+/.test(navigator.userAgent);
}


export function isIEorEdge() {
return /Edge\/\d+/.test(navigator.userAgent) ||
/MSIE\/\d+/.test(navigator.userAgent) ||
/Trident\/\d+/.test(navigator.userAgent);
}
73 changes: 73 additions & 0 deletions src/ytmodal/_ytmodal.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
$button-height: 50px !default
$color-black: #000 !default
$color-white: #fff !default

.ytmodal
cursor: pointer

.ytmodal-player
display: none
height: 100%
left: 0
opacity: 0
position: fixed
top: 0
transform: scale(1.15)
transition: all .3s cubic-bezier(.4,0,.2,1)
visibility: hidden
width: 100%
z-index: 2000

&--enabled
display: block

&--visible
opacity: 1
transform: scale(1)
visibility: visible

.ytmodal-player__x
background: $color-black
color: $color-white
cursor: pointer
font-size: $button-height
height: $button-height
line-height: $button-height
opacity: 0.8
overflow: hidden
position: absolute
right: 0
text-align: center
top: 0
transition: all .3s
width: $button-height
z-index: 2004

&:before
content: "\00D7"
display: block
font-family: 'arial', sans-serif
height: $button-height
line-height: $button-height
text-align: center
vertical-align: middle
width: $button-height

&:hover
color: $color-black
background: $color-white

.ytmodal-player__mask
background: $color-white
height: 100%
left: 0
position: absolute
top: 0
width: 100%
z-index: 2001

.ytmodal-player__player
height: 100%
position: relative
width: 100%
z-index: 2002
54 changes: 54 additions & 0 deletions src/ytmodal/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% extends "docs/base.html" %}

{% block title %}Airkit2 - YTModalComponent{% endblock %}

{% block styles %}
{{macros.style_tag('ytmodal/ytmodal.example.min.css')}}
{% endblock %}

{% block head_scripts %}
{{macros.script_tag('ytmodal/ytmodal.example.min.js')}}
{% endblock %}

{% block main %}
<h1>YTModalComponent</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

<h2>LazyImageComponentOptions</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>modalPlayer</td>
<td>{YTModalPlayer}</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
<td>null</td>
</tr>
</tbody>
</table>

<h2>Example</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

{% set example %}
<button class="ytmodal" data-youtube-id="Q0CbN8sfihY">Open YT Modal</button>
{% endset %}

{{example|safe}}

<h3>HTML</h3>
<pre><code class="html">{{example.trim()}}</code></pre>

<h3>SASS</h3>
{{macros.source_code('ytmodal/ytmodal.example.sass')}}

<h3>JavaScript</h3>
{{macros.source_code('ytmodal/ytmodal.example.js')}}
{% endblock %}
9 changes: 9 additions & 0 deletions src/ytmodal/ytmodal.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Registry from '../component/registry';
import YTModalComponent from '../ytmodal/ytmodalcomponent';


const app = new Registry();
app.register('ytmodal', YTModalComponent, {});
document.addEventListener('DOMContentLoaded', () => {
app.run();
});
1 change: 1 addition & 0 deletions src/ytmodal/ytmodal.example.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'ytmodal'
Loading