Skip to content

Commit 343a834

Browse files
authored
Pickup Video from original repo (#558)
* Why Vue video for the Front Page (#1325) * Add icons play and dark GitHub icon. * Increase width and update margins of inner class * Add modal for video player * Add and update hero buttons * Add Vimeo analytics * Update video with correct video url * Add autoplay on video open * Add aria and lang to svgs * Rename Github button * rename class for button with icon * Update class for icon in html * abort vimeo modal init if vimeo not in page
1 parent 6b99d65 commit 343a834

File tree

11 files changed

+96
-8
lines changed

11 files changed

+96
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<svg aria-labelledby="simpleicons-github-dark-icon" lang role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-github-icon" lang="en">GitHub Dark icon</title><path fill="#7F8C8D" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>

themes/vue/layout/icons/github.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<svg aria-labelledby="simpleicons-github-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-github-icon">GitHub icon</title><path fill="#FFFFFF" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
1+
<svg aria-labelledby="simpleicons-github-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-github-icon" lang="en">GitHub icon</title><path fill="#FFFFFF" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>

themes/vue/layout/icons/medium.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<svg aria-labelledby="simpleicons-medium-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-medium-icon">Medium icon</title><path fill="#FFFFFF" d="M2.846 6.36c.03-.295-.083-.586-.303-.784l-2.24-2.7v-.403H7.26l5.378 11.795 4.728-11.795H24v.403l-1.917 1.837c-.165.126-.247.333-.213.538v13.5c-.034.204.048.41.213.537l1.87 1.837v.403h-9.41v-.403l1.937-1.882c.19-.19.19-.246.19-.538V7.794l-5.39 13.688h-.727L4.278 7.794v9.174c-.052.386.076.774.347 1.053l2.52 3.06v.402H0v-.403l2.52-3.06c.27-.278.39-.67.326-1.052V6.36z"/></svg>
1+
<svg aria-labelledby="simpleicons-medium-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-medium-icon" lang="en">Medium icon</title><path fill="#FFFFFF" d="M2.846 6.36c.03-.295-.083-.586-.303-.784l-2.24-2.7v-.403H7.26l5.378 11.795 4.728-11.795H24v.403l-1.917 1.837c-.165.126-.247.333-.213.538v13.5c-.034.204.048.41.213.537l1.87 1.837v.403h-9.41v-.403l1.937-1.882c.19-.19.19-.246.19-.538V7.794l-5.39 13.688h-.727L4.278 7.794v9.174c-.052.386.076.774.347 1.053l2.52 3.06v.402H0v-.403l2.52-3.06c.27-.278.39-.67.326-1.052V6.36z"/></svg>

themes/vue/layout/icons/play.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<svg aria-labelledby="simpleicons-play-icon" role="img" viewBox="0 0 100 125" fill="#FFFFFF"><title id="simpleicons-play-icon" lang="en">Play icon</title><path d="M50,3.8C24.5,3.8,3.8,24.5,3.8,50S24.5,96.2,50,96.2S96.2,75.5,96.2,50S75.5,3.8,50,3.8z M71.2,53.3l-30.8,18 c-0.6,0.4-1.3,0.5-1.9,0.5c-0.6,0-1.3-0.1-1.9-0.5c-1.2-0.6-1.9-1.9-1.9-3.3V32c0-1.4,0.8-2.7,1.9-3.3c1.2-0.6,2.7-0.6,3.8,0 l30.8,18c1.2,0.6,1.9,1.9,1.9,3.3S72.3,52.7,71.2,53.3z"/></svg>

themes/vue/layout/icons/twitter.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<svg aria-labelledby="simpleicons-twitter-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-twitter-icon">Twitter icon</title><path fill="#FFFFFF" d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"/></svg>
1+
<svg aria-labelledby="simpleicons-twitter-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-twitter-icon" lang="en">Twitter icon</title><path fill="#FFFFFF" d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"/></svg>

themes/vue/layout/index.ejs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
The Progressive<br>JavaScript Framework
1717
</h1>
1818
<p>
19-
<a class="button" href="<%- url_for("/v2/guide/") %>">はじめる</a>
20-
<a class="button white" href="https://github.com/vuejs/vue" target="_blank">GITHUB</a>
19+
<a id="modal-player" class="button has-icon" href="javascript:;">
20+
<%- partial('icons/play') %>
21+
なぜ VUE.JS ?</a>
22+
<a class="button white" href="<%- url_for("/v2/guide/") %>">はじめる</a>
23+
<a class="button gray has-icon" href="https://github.com/vuejs/vue" target="_blank">
24+
<%- partial('icons/github-dark') %>
25+
GITHUB</a>
2126
</p>
2227
</div>
2328
</div>
@@ -78,6 +83,10 @@
7883
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You</p>
7984
</div>
8085

86+
<div id="video-modal" class="modal">
87+
<div class="vimeo-space" style="padding: 56.25% 0 0 0; position: relative;"><iframe src="https://player.vimeo.com/video/247494684" style="height: 100%; left: 0; position: absolute; top: 0; width: 100%;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
88+
</div>
89+
8190
<script>
8291
(function () {
8392
var topScrolled = false

themes/vue/layout/layout.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
7171
ga('send', 'pageview');
7272
</script>
73+
74+
<!-- vimeo analytics -->
75+
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/72160148.js"></script>
7376
</head>
7477
<body class="<%- isIndex ? '' : 'docs' -%>">
7578
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>

themes/vue/source/css/_common.styl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,21 @@ a.button
5757
transition: all .15s ease
5858
box-sizing: border-box
5959
border: 1px solid lighten($green, 8%)
60+
&.has-icon
61+
position: relative
62+
text-indent: 1.4em;
63+
> svg
64+
position: absolute
65+
left: 0.4em
66+
top: 0.4em
67+
width: 2em
6068
&.white
6169
background-color: #fff
6270
color: $green
71+
&.gray
72+
background-color: #f6f6f6
73+
color: $light
74+
border-color: #f6f6f6
6375

6476
.highlight
6577
overflow-x: auto

themes/vue/source/css/_modal.styl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.modal
2+
box-sizing: border-box
3+
display: none
4+
position: fixed
5+
width: 80%
6+
height: auto
7+
padding: .5em
8+
background-color: #f9f9f9
9+
box-shadow: 0 0 10px rgba(0,0,0,.2)
10+
z-index: 11
11+
&.open
12+
display: block
13+
top: 50%
14+
left: 50%
15+
transform: translate(-50%, -50%)
16+
.overlay
17+
position: fixed
18+
top: 0
19+
bottom: 0
20+
left: 0
21+
right: 0
22+
background: rgba(0,0,0,.2)
23+
z-index: 10
24+
.stop-scroll
25+
overflow: hidden
26+
height: 100%
27+
@media screen and (max-width: 400px)
28+
.modal
29+
width: 98%

themes/vue/source/css/index.styl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@import "_header"
33
@import "_sidebar"
44
@import "_sponsor"
5+
@import "_modal"
56

67
$width = 900px
78
$space = 40px
@@ -29,7 +30,7 @@ body
2930
padding: $space 40px 30px
3031
background-color: #fff
3132
.inner
32-
max-width: $width
33+
max-width: $width * 1.4
3334
margin: 0 auto
3435
.left, .right
3536
display: inline-block
@@ -60,8 +61,8 @@ body
6061
letter-spacing: .1em
6162
min-width: 8em
6263
text-align: center
63-
&:first-child
64-
margin-right: 1em
64+
&:not(:last-child)
65+
margin-right: 1%
6566
.social-buttons
6667
list-style-type: none
6768
padding: 0

themes/vue/source/js/common.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(function () {
22
initMobileMenu()
3+
initVideoModal()
34
if (PAGE_TYPE) {
45
initVersionSelect()
56
initSubHeaders()
@@ -132,6 +133,37 @@
132133
})
133134
}
134135

136+
/**
137+
* Modal Video Player
138+
*/
139+
function initVideoModal () {
140+
if (typeof Vimeo === 'undefined') return
141+
142+
var modalButton = document.getElementById('modal-player')
143+
var videoModal = document.getElementById('video-modal')
144+
var iframe = document.querySelector('iframe');
145+
var player = new Vimeo.Player(iframe);
146+
var overlay = document.createElement('div')
147+
overlay.className = 'overlay'
148+
149+
150+
modalButton.addEventListener('click', function() {
151+
videoModal.classList.toggle('open')
152+
document.body.classList.toggle('stop-scroll')
153+
document.body.appendChild(overlay)
154+
player.play()
155+
})
156+
157+
document.body.addEventListener('click', function(e) {
158+
if (e.target !== modalButton && !videoModal.contains(e.target)) {
159+
videoModal.classList.remove('open')
160+
document.body.classList.remove('stop-scroll')
161+
document.body.removeChild(overlay)
162+
player.unload()
163+
}
164+
})
165+
}
166+
135167
/**
136168
* Doc version select
137169
*/

0 commit comments

Comments
 (0)