This repository has been archived by the owner on Jun 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from 201-created/rondale-sc/native-classes
Native classes, tracked properties, glimmer components
- Loading branch information
Showing
12 changed files
with
1,731 additions
and
152 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'recommended' | ||
extends: 'recommended', | ||
|
||
rules: { | ||
'no-invalid-interactive': false | ||
} | ||
}; |
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,14 +1,13 @@ | ||
import Component from '@ember/component'; | ||
import Component from '@glimmer/component'; | ||
import { computed } from '@ember/object'; | ||
import moment from 'emberconf/libs/moment'; | ||
|
||
export default Component.extend({ | ||
day: null, | ||
index: 0, | ||
export default class extends Component { | ||
|
||
title: computed('day.date', 'index', function () { | ||
let dayNumber = this.index + 1; | ||
let formattedDate = moment(this.get('day.date')).format('MMMM D'); | ||
@computed('day.date', 'index') | ||
get title() { | ||
let dayNumber = this.args.index + 1; | ||
let formattedDate = moment(this.args.day.date).format('MMMM D'); | ||
return `Day ${dayNumber}: ${formattedDate}`; | ||
}) | ||
}); | ||
} | ||
} |
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,40 +1,41 @@ | ||
import Component from '@ember/component'; | ||
import Component from '@glimmer/component'; | ||
import { computed } from '@ember/object'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import ENV from 'emberconf/config/environment'; | ||
import moment from 'emberconf/libs/moment'; | ||
|
||
export default Component.extend({ | ||
classNames: ['session'], | ||
classNameBindings: ['isBreak', 'isExpanded', 'isNow', 'isPast'], | ||
export default class extends Component { | ||
@tracked | ||
isExpanded = false; | ||
|
||
now: moment().format(), | ||
isExpanded: false, | ||
session: null, | ||
|
||
isBreak: computed('session.name', function() { | ||
return ['Lunch', 'Snack Break'].includes(this.get('session.name')); | ||
}), | ||
@computed('session.name') | ||
get isBreak() { | ||
return ['Lunch', 'Snack Break'].includes(this.args.session.name); | ||
} | ||
|
||
isNow: computed('now', 'session.{start,end}', function() { | ||
return moment(this.now).isBetween(this.get('session.start', null, '[)'), this.get('session.end')); | ||
}), | ||
@computed('now', 'session.{start,end}') | ||
get isNow() { | ||
return moment(this.args.now).isBetween(this.args.session.start, this.args.session.end, null, '[)'); | ||
} | ||
|
||
isPast: computed('now', 'session.end', function() { | ||
return moment(this.now).isSameOrAfter(this.get('session.end')); | ||
}), | ||
@computed('now', 'session.end') | ||
get isPast() { | ||
return moment(this.args.now).isSameOrAfter(this.args.session.end); | ||
} | ||
|
||
formattedTime: computed('session.{start,end}', function() { | ||
let startMoment = this._pdxMoment(this.get('session.start')); | ||
let endMoment = this._pdxMoment(this.get('session.end')); | ||
@computed('session.{start,end}') | ||
get formattedTime() { | ||
let startMoment = this._pdxMoment(this.args.session.start); | ||
let endMoment = this._pdxMoment(this.args.session.end); | ||
let startFormat = (startMoment.format('a') === endMoment.format('a')) ? 'h:mm' : 'h:mma'; | ||
return `${startMoment.format(startFormat)}-${endMoment.format('h:mma')}`; | ||
}), | ||
} | ||
|
||
_pdxMoment(timestamp) { | ||
return moment(timestamp).utcOffset(ENV.APP.UTC_OFFSET); | ||
}, | ||
} | ||
|
||
click() { | ||
this.toggleProperty('isExpanded'); | ||
toggleExpanded() { | ||
this.isExpanded = !this.isExpanded; | ||
} | ||
}); | ||
} |
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,26 +1,21 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import Component from '@glimmer/component'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
fastboot: service(), | ||
export default class extends Component { | ||
@service fastboot; | ||
|
||
tagName: 'footer', | ||
classNameBindings: ['isDismissed'], | ||
get isDismissed() { | ||
if (this.fastboot.isFastBoot) { | ||
return true; | ||
} else { | ||
return document.cookie.split(';').indexOf('isDismissed=true') >= 0; | ||
} | ||
} | ||
|
||
isDismissed: computed({ | ||
get(key) { // eslint-disable-line no-unused-vars | ||
if (this.get('fastboot.isFastBoot')) { | ||
return true; | ||
} else { | ||
return document.cookie.split(';').indexOf('isDismissed=true') >= 0; | ||
} | ||
}, | ||
set(key, value) { // eslint-disable-line no-unused-vars | ||
if (!this.get('fastboot.isFastBoot')) { | ||
document.cookie = 'isDismissed=true'; | ||
} | ||
return value; | ||
set isDismissed(value) { | ||
if (!this.fastboot.isFastBoot) { | ||
document.cookie = 'isDismissed=true'; | ||
} | ||
}) | ||
}); | ||
return value; | ||
} | ||
} |
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
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,33 +1,44 @@ | ||
<small>{{this.formattedTime}}</small> | ||
<div | ||
...attributes | ||
class={{concat "session" | ||
(if this.isBreak " is-break") | ||
(if this.isExpanded " is-expanded") | ||
(if this.isNow " is-now") | ||
(if this.isPast " is-past") | ||
}} | ||
{{action this.toggleExpanded}} | ||
> | ||
<small>{{this.formattedTime}}</small> | ||
|
||
<h3>{{@session.name}}</h3> | ||
<h3>{{@session.name}}</h3> | ||
|
||
{{#if @session.speakers}} | ||
<ul class="speakers"> | ||
{{#each @session.speakers as |speaker|}} | ||
<li>{{speaker}}</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
{{#if @session.speakers}} | ||
<ul class="speakers"> | ||
{{#each @session.speakers as |speaker|}} | ||
<li>{{speaker}}</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
|
||
{{#if @session.description}} | ||
<div class="description"> | ||
<p>{{@session.description}}</p> | ||
{{#if @session.description}} | ||
<div class="description"> | ||
<p>{{@session.description}}</p> | ||
|
||
{{#if @session.sessions}} | ||
<ul class="minitalks"> | ||
{{#each @session.sessions as |minitalk|}} | ||
<li> | ||
<small>{{minitalk.time}}</small> | ||
<h4>{{minitalk.title}}</h4> | ||
<ul class="speakers"> | ||
{{#each minitalk.speakers as |speaker|}} | ||
<li>{{speaker}}</li> | ||
{{/each}} | ||
</ul> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
</div> | ||
{{/if}} | ||
{{#if @session.sessions}} | ||
<ul class="minitalks"> | ||
{{#each @session.sessions as |minitalk|}} | ||
<li> | ||
<small>{{minitalk.time}}</small> | ||
<h4>{{minitalk.title}}</h4> | ||
<ul class="speakers"> | ||
{{#each minitalk.speakers as |speaker|}} | ||
<li>{{speaker}}</li> | ||
{{/each}} | ||
</ul> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
</div> | ||
{{/if}} | ||
</div> |
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,7 +1,12 @@ | ||
<p>Curious what's going on here?</p> | ||
<p> | ||
<a href="https://github.com/201-created/emberconf-schedule-2018" target="_blank" rel="noopener" aria-label="GitHub"> | ||
Check out the code on GitHub! | ||
</a> | ||
</p> | ||
<button class="close" {{action (mut this.isDismissed) true}}>×</button> | ||
<footer | ||
...attributes | ||
class={{if this.isDismissed "is-dismissed"}} | ||
> | ||
<p>Curious what's going on here?</p> | ||
<p> | ||
<a href="https://github.com/201-created/emberconf-schedule-2018" target="_blank" rel="noopener" aria-label="GitHub"> | ||
Check out the code on GitHub! | ||
</a> | ||
</p> | ||
<button class="close" {{action (mut this.isDismissed) true}}>×</button> | ||
</footer> |
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
Oops, something went wrong.