-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
737 lines (629 loc) · 22.6 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
(function () {
'use strict';
const m = (el, children) => {
children.forEach( $el => {
if(Array.isArray($el)){
m(el, $el)
}else if(typeof $el === 'string'){
el.appendChild(document.createTextNode($el))
}else{
el.appendChild($el)
}
})
}
const h = (tag, className, ...children) => {
const el = document.createElement(tag)
el.className = className
m(el, children)
console.log(el)
return el
}
const wait = (time) => {
return new Promise( res=> {
setTimeout(res, time)
})
}
//intro components
const intro_text = h('span', '', 'made with 💖 in 🗽')
const intro = h('div', 'intro', intro_text)
const logo = h('img', 'logo')
logo.src = 'assets/img/logo.png'
const button = (icon, text, clz= '') => {
let btn_text = h('span', '', text);
let btn_icon = h('i', icon);
let $btn = h('div', 'btn '+clz, btn_icon, btn_text)
return $btn;
}
const header = (tip, title, tag, clz = '') => {
const tipel = h('span', 'tip', tip)
const titleel = h('h2', 'title', title)
const el = h('div', 'header-block ' + clz, tipel, titleel)
return el;
}
const MoveOnScroll = (component, opts = {}) => {
const options = Object.assign({},{
animation: {
enable: true,
transform: true,
type: '',
},
min: 0,
max: 40,
trigger: (change, el) => el.style.transform = `translate(0px, ${change}px)`,
onVisible: null,
onInvisible: null,
container: component.parentElement
}, opts)
if(typeof component['__mos'] === 'undefined'){
component.__mos = {
isVisible: false
}
}
options.container.addEventListener('scroll', e=>updateItem(component, options.container))
function updateItem(el, holder) {
const { top:elemTop, bottom:elemBottom, height:elemHeight } = el.getBoundingClientRect()
const { top:holderTop, bottom:holderBottom } = holder.getBoundingClientRect()
let isVisible;
let offset;
if (elemTop <= holderTop) {
//scroll pass the element
offset = window.innerHeight
isVisible = !(holderTop - elemTop > elemHeight);
} else {
//scroll before the element
offset = elemBottom - holderBottom - elemHeight
if(holder.scrollTop < elemTop) offset = holder.scrollTop;
isVisible = !(elemBottom - holderBottom > elemHeight);
}
if(isVisible){
if(!el.__mos.isVisible){
//visible first time
el.__mos.isVisible = true
if(options.onVisible) options.onVisible(el);
//console.log('seen', el, holder)
}
if(options.animation.enable){
let changeValue = 0
changeValue = Math.abs(offset) / window.innerHeight * options.max + options.min
options.trigger(changeValue, el)
}
}else{
if(el.__mos.isVisible){
el.__mos.isVisible = false
if(options.onInvisible) options.onInvisible(el);
}
}
}
return component;
}
const moveOnScrollOpacity = (component, opt = {}, withold = 25) =>{
return MoveOnScroll(component, Object.assign({},{
trigger : (change, el) => {
el.style.transform = `translate(0px, ${change}px)`
el.style.opacity = change / parseFloat(withold)
}
}, opt))
}
const showOnSeen = (component, container, clz = 'visible') => {
return MoveOnScroll(component, {
container,
onVisible: el=>el.classList.add(clz),
onInvisible: el=>el.classList.remove(clz),
max: 0
}, 0)
}
const about_name = h('p', 'about-name', 'Charlie Lin')
const about_title = h('p', 'about-title', 'FOUNDER / WEB DEVELOPER')
const last_update = h('p', 'about-update', 'Last Updated: 2017-10-10')
const down_indicator = button('fa fa-long-arrow-down', '', 'btn-grey about-btn')
const about = h('div', 'about', about_name, about_title, last_update)
const about_detail = container =>
{
const iconNYC = h('img', '')
iconNYC.src = 'assets/img/nyc.png'
const badgeNYC= h('div', 'about-detail_badges-badge 1/2 1/3--desk grid__cell', iconNYC, 'Proud New Yoker')
const iconChinese = h('img', '')
iconChinese.src = 'assets/img/chinese.png'
const badgeChinese= h('div', 'about-detail_badges-badge 1/2 1/3--desk grid__cell', iconChinese, 'Made in China')
const iconUSMC = h('img', '')
iconUSMC.src = 'assets/img/usmc.png'
const badgeUSMC= h('div', 'about-detail_badges-badge 1/2 1/3--desk grid__cell', iconUSMC, 'Veteran Marines')
const badgeArea = h('div', 'about-detail_badges', badgeNYC, badgeChinese, badgeUSMC)
const photo = h('img', 'about-detail_photo')
photo.src = 'assets/img/charlie.jpg'
return h('div', 'about-detail bg-dark',
moveOnScrollOpacity(header('Little About Me', 'Personal Information', ''), {
container
}),
moveOnScrollOpacity(h(
'p', 'about-detail_intro',
'Charlie is a founder, designer, developer and IT consultant that specializes in creating beautiful software products. Some of his clients include startups, small business, Facebook and Tencent.'),
{container}, 15
),
moveOnScrollOpacity(badgeArea, {container}, 15),
photo
);
}
const codeMock = (code = []) => {
const cursor = h('span', 'code-mock_editor-cursor', '_');
const content = code.map( str=> h('p', 'code-mock_editor-line', str , cursor.cloneNode(true)))
const menu = h('div', 'code-mock_menu bg-white bs',
h('div', 'code-mock_menu-btn close'),
h('div', 'code-mock_menu-btn minimize'),
h('div', 'code-mock_menu-btn zoom')
)
const editor = h('div', 'code-mock_editor bs-2', content)
const el = h('div', 'code-mock monoki', menu, editor)
return el;
}
const progress = (title = '', percent = 70, tag = '', clz = '', shadow = false) => {
const $tag = h('span', 'progress-tag', tag)
const $shadow = shadow ? h('div', 'progress-bar_inner-shadow') : ''
const $inner = h('div', 'progress-bar_inner', $shadow)
const $bar = h('div', 'progress-bar', $inner, $tag)
$bar.style.width = percent+'%'
const $title = h('h2', 'progress-title', title)
const el = h('div', 'progress ' + clz, $bar, $title)
return el;
}
const morelink = 'https://www.linkedin.com/in/n7best/'
const codes = [
`[`,
` "I'm a web developer", `,
` "I'm a designer", `,
` "lets's work together!" `,
`]`
]
const data = [
{
title: 'Design',
items: [
{
title: 'Photoshop',
tag: 'Over 8 Years',
percent: 90,
style: 'bar-blue-purple'
},
{
title: 'Sketch',
tag: 'For My UI & Web Designs',
percent: 80,
style: 'bar-blue-purple'
},
{
title: 'Html/CSS',
tag: 'Code for design',
percent: 95,
style: 'bar-blue-purple'
},
]
},
{
title: 'Coding',
items: [
{
title: 'Javascript',
tag: 'I\'m a Frontend Passionist',
percent: 90,
style: 'bar-red-purple'
},
{
title: 'PHP',
tag: 'All starts with the CGI/PHP era',
percent: 80,
style: 'bar-red-purple'
},
{
title: 'C++/JAVA',
tag: 'Fundenmentals, what school teachs',
percent: 70,
style: 'bar-red-purple'
},
]
}
]
const skills = container => {
const skill_list = data.map( sec => {
return [
h('h3', 'section-title', sec.title),
sec.items.map( item=> {
return showOnSeen(progress(item.title, item.percent, item.tag, item.style), container)
})
]
})
const bgimg = h('img', 'skills-bg')
bgimg.src = "assets/img/skillbackground.jpg";
const btnMore = button('fa fa-info-circle','Learn More','skills-btn')
btnMore.addEventListener('click', e=> window.open(morelink, '_blank'))
return h('div', 'skills',
moveOnScrollOpacity(header('What I\'m good at', 'Professional Skills', ''), {
container
}),
moveOnScrollOpacity(h(
'p', 'skills_intro',
'I believe to craft a masterpiece, every fundamental element of the process had to be masterd. I am skilled from product concept, marketing, sales channel to software architecture, design and programming.'),
{container}, 15
),
showOnSeen(codeMock(codes), container),
moveOnScrollOpacity(header('', 'Your favor apps, My expertise', '', 'text-left w-60p'), {
container
}),
moveOnScrollOpacity(h(
'p', 'skills_intro text-left m-b-5',
'I am specialize to design and build interactive web applications.'),
{container}, 15
),
h('div', 'skills_data m-auto w-60p text-left', skill_list),
showOnSeen(btnMore,container, 'expand'),
MoveOnScroll(bgimg, {container})
);
}
const data$1 = [
{
title: 'Github',
catalog: 'Open Source',
img: 'assets/portfolio/github.jpg',
link: 'https://github.com/n7best'
},
{
title: 'Codepen',
catalog: 'Frontend',
img: 'assets/portfolio/codepen.png',
link: 'https://codepen.io/n7best'
},
{
title: 'WeUI',
catalog: 'UI/UX',
img: 'assets/portfolio/weui.jpg',
link: 'https://github.com/Tencent/weui'
},
{
title: 'Pariswedding',
catalog: 'Small Business',
img: 'assets/portfolio/paris.jpg',
link: 'https://pariswedding.nyc'
},
{
title: 'Macao Tea',
catalog: 'Small Business',
img: 'assets/portfolio/mit.png',
link: 'http://macaoimperialtea.us/'
},
{
title: 'CoinPen',
catalog: 'Bloackchain',
img: 'assets/portfolio/coinpen.png',
link: 'http://coinpen.io'
}
]
const portfolio = container => {
const display = h('div', 'portfolio_photos', data$1.map( item=> {
const img = h('img', 'portfolio_photos-item-img')
const icon = h('h3', 'portfolio_photos-item-icon', item.title[0].toUpperCase() + item.title[1].toLowerCase())
img.src = item.img
icon.style.backgroundImage = `url(${item.img})`
const title_chunks = item.title.match(/.{1,2}/g).map(str=>{
return h('span', 'portfolio_photos-item-title_chunk', str)
})
let el = h(item.link ? 'a' : 'div', 'portfolio_photos-item',
img,
h('div', 'dark-bg'),
icon,
h('h3', 'portfolio_photos-item-title', title_chunks)
)
if(item.link) {
el.href = item.link
el.target = "_blank"
}
return el;
}))
const $el = h('div', 'portfolio bg-dark',
moveOnScrollOpacity(header('My latest crafts', 'Portfolio', ''), {
container
}),
h('div', 'portfolio_contents w-60p m-auto', display)
);
$el.onMounted = ()=> {
var iso = new Isotope( display, {
// options
itemSelector: '.portfolio_photos-item',
layoutMode: 'masonry',
masonry: {
isFitWidth: true
}
});
}
return $el
}
const data$2 = [
{
from: {
year: '2012',
month: 'Apr'
},
to: {
year: 'Present',
month: ''
},
title: 'Fullstack Web Developer',
company: 'Freelancer & Vision Media Marketing',
detail: `Fullstack to me means from the campaigning advertisement to the meeting table with you, from product ideas to product launched and from product design to scalable software.`,
icons: [
'icon-html5-01',
'icon-css3-01',
'icon-prog-js01'
]
},
{
from: {
year: '2011',
month: 'Apr'
},
to: {
year: 'Present',
month: ''
},
title: 'Director of Technology',
company: 'Paris Wedding Group',
detail: `Responsobile for overall planning, organizing, and execution of all IT functions throughout all retail location and studios.`,
icons: []
},
{
from: {
year: '2012',
month: 'nov'
},
to: {
year: '2016',
month: 'Apr'
},
title: 'Communication Technician',
company: 'United States Marine Corps',
detail: `Maintains, operates and repairs sophisticated and modern equipment and systems which include: air defense and surveillance radar systems, aviation radio communication systems, air traffic control systems, command and control tactical data systems, and short range air defense weapon systems.`,
icons: []
}
]
const experiences = container => {
const timeline = data$2.map( item=> {
return h('div', 'experiences_content-item',
h('div', 'experiences_content-item_date 2/6--desk grid__cell',
h('h2', 'experiences_content-item_date-year', `${item.from.year} - ${item.to.year}`),
item.from.month ? h('span','experiences_content-item_date-month', item.from.month) : '',
item.to.month ? h('span','experiences_content-item_date-month', item.to.month) : ''
),
h('div', '4/6--desk grid__cell',
h('h3', '', item.title),
h('h6', '', item.company),
h('p', '', item.detail),
h('ul', 'icon-list', item.icons.map( icon=> h('li', icon)))
)
)
})
const bgImg = h('img', 'table')
bgImg.src = 'assets/img/table.png'
const lamp = h('img', 'lamp')
lamp.src = 'assets/img/lamp.png'
const book = h('img', 'book')
book.src = 'assets/img/book.png'
const tabledeco = h('img', 'tabledeco')
tabledeco.src = 'assets/img/tabledeco.png'
const el = h('div', 'experiences',
moveOnScrollOpacity(header('Where I came from', 'Work Experiences', ''), {
container
}),
moveOnScrollOpacity(h(
'p', 'experiences_intro',
/* 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem.' */''),
{container}, 15
),
h('div', 'experiences_content text-left w-60p',
timeline
),
h('div', 'experiences_bg',
MoveOnScroll(bgImg,{container}),
moveOnScrollOpacity(lamp,{container}),
moveOnScrollOpacity(book,{container}),
moveOnScrollOpacity(tabledeco, {container})
)
)
return el;
}
const bubble = (icon, text, right = false, color = 'white' , clz = '') => {
let $text = h('p', '', text);
let btn_icon = h('i', icon);
let el = h('div', `chat-bubble ${right ? 'right' : 'left'} ${color} ${clz}`, $text)
return el;
}
const iphone = (container, content) => {
const el = h('div', 'holder',
h('div', 'outline bs-2',
h('div', 'screen center-block',
content,
h('div', 'top-bump center-block',
h('div', 'ear-speaker'),
h('div', 'camera', h('div', 'inner-camera'))
),
h('i', 'fa fa-battery pull-right notification-icons'),
h('i', 'fa fa-wifi pull-right notification-icons'),
h('i', 'fa fa-signal pull-right notification-icons'),
h('div', 'vol-up'),
h('div', 'vol-down'),
h('div', 'silent'),
h('div', 'power'),
h('div', 'unlock-bar')
)
)
)
return el
}
const data$3 = {
info: {
title: 'Let\'s have a talk',
intro: 'You need a product/website that\'s well design and actually works. That\'s what I offer. And if you want to learn more about working with me, send me a message.',
icons: [
{
className: 'fa fa-twitter',
link: 'https://twitter.com/n7best'
},
{
className: 'fa fa-linkedin',
link: 'https://www.linkedin.com/in/n7best/'
}
],
address: {
line1: '65-30 Kissena Blvd.',
line2: 'CEP Hall 2',
city: 'Queens, NY 11367'
},
phone: '888-898-8666',
email: '[email protected]'
},
chat: {
name: 'Charlie',
avatar: "assets/img/charlie.jpg",
messages: [
'Hey there!😃 What\'s up?!',
'Checking out your profile you know..',
'Ok cool, Let me know if you have any question 👄👄~~'
]
},
map: {
place: {
lat: 40.738168, lng: -73.819524
},
bg: 'assets/img/newyork.jpg'
}
}
const contact = container => {
const chaticon = h('div', 'contact_chat-appbar_icon')
chaticon.style.backgroundImage = `url(${data$3.chat.avatar})`
const mapEl = h('div', 'map')
const mapBox = h('div', 'contact_numbers-block 2/3--desk', mapEl);
mapBox.style.backgroundImage = `url(${data$3.map.bg})`
const btnMap = h('p', 'btn-map', 'View on the map', h('i', 'fa fa-map-o'))
btnMap.addEventListener('click', e=> {
mapEl.classList.toggle('active')
if(mapEl.classList.contains('active')){
btnMap.firstChild.textContent = 'Close map'
}else{
btnMap.firstChild.textContent = 'View on the map'
}
})
function initMap() {
const place = data$3.map.place;
const map = new google.maps.Map(mapEl, {
zoom: 12,
center: place
});
const marker = new google.maps.Marker({
position: place,
map: map
});
map.setCenter(new google.maps.LatLng(place.lat, place.lng));
}
const el = h('div', 'contact',
h('div', 'contact_content',
h('div', '1/3--desk',
MoveOnScroll(iphone(container,
h('div', 'contact_chat',
h('div', 'contact_chat-appbar', chaticon, h('p', 'contact_chat-appbar_name', data$3.chat.name)),
showOnSeen(bubble('', data$3.chat.messages[0]), container, 'loud'),
h('div','clear'),
showOnSeen(bubble('', data$3.chat.messages[1], true, 'blue ani-delay-15'), container, 'slam'),
h('div','clear'),
showOnSeen(bubble('', data$3.chat.messages[2], false, 'white ani-delay-30'), container, 'gentle')
)
), {container})
),
h('div', 'contact_content-detail 2/3--desk',
moveOnScrollOpacity(header(data$3.info.title, 'Contacts', '', 'text-left'), {
container
}),
moveOnScrollOpacity(h( 'p', 'contact_content-detail_intro', data$3.info.intro),
{container}, 15
),
moveOnScrollOpacity(h('ul', 'icon-list', data$3.info.icons.map( icon=> {
const el = h('a', '' ,h('li', icon.className));
el.href = icon.link
el.target = "_blank"
return el;
})),{
container
})
)
),
h('div', 'contact_numbers',
h('div', 'contact_numbers-detail 1/3--desk text-left',
h('h5', '', 'Address'),
h('p', '', data$3.info.address.line1),
h('p', '', data$3.info.address.line2),
h('p', '', data$3.info.address.city),
btnMap,
h('br',''),
h('h5', '', 'Phone'),
h('p', '', data$3.info.phone),
h('br',''),
h('h5', '', 'Email'),
h('p', '', data$3.info.email)
),
mapBox
)
)
el.onMounted = () => {
initMap();
}
return el;
}
const footer = container => {
return h('div', 'footer', 'Copyright 2011 - ' + new Date().getFullYear() + ' Charlie Lin')
}
const container = h('div', 'container', intro, about, down_indicator)
document.body.appendChild(container)
const $portfolio = portfolio(container);
const $contact = contact(container)
//timeline
wait(2000)
.then( ()=> {
intro.className = 'intro active'
return wait(1000)
})
.then( ()=> {
intro.className = 'intro active bs'
container.className = 'container bg-white'
intro_text.style.display = 'none'
intro.appendChild(logo)
return wait(700)
})
.then( ()=> {
container.style.background = 'transparent'
intro.className = 'intro active bg-grey'
return wait(700)
})
.then( ()=> {
intro.className = 'intro active bg-blue'
MoveOnScroll(intro)
return wait(500)
})
.then( ()=> {
container.className = 'container bg-white block'
about.className = 'about block'
down_indicator.style.display = 'inline-block';
return wait(500)
})
.then( ()=> {
down_indicator.style.opacity = 1;
//add main content
container.appendChild(about_detail(container))
container.appendChild(skills(container))
container.appendChild(experiences(container))
container.appendChild($portfolio)
container.appendChild($contact)
container.appendChild(footer(container))
return wait(1000)
})
.then( ()=> {
$portfolio.onMounted()
$contact.onMounted()
})
}());
//# sourceMappingURL=app.js.map