feat: filter the timeline according to the picker
This commit is contained in:
parent
9179c7637d
commit
3cdf4aa6aa
15
src/App.vue
15
src/App.vue
|
@ -1,17 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<Home/>
|
<Home/>
|
||||||
<SkillPicker/>
|
<SkillPicker @pick='onPick($event)'/>
|
||||||
<Timeline/>
|
<Timeline ref='timeline'/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator';
|
import { Component, Vue } from 'vue-property-decorator';
|
||||||
|
import { tID } from '@/model/skills';
|
||||||
import Home from './components/Home.vue';
|
import Home from './components/Home.vue';
|
||||||
import Timeline from './components/Timeline.vue';
|
import Timeline from './components/Timeline.vue';
|
||||||
import SkillPicker from './components/SkillPicker.vue';
|
import SkillPicker from './components/SkillPicker.vue';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
Home,
|
Home,
|
||||||
|
@ -20,6 +22,15 @@ import SkillPicker from './components/SkillPicker.vue';
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class App extends Vue {
|
export default class App extends Vue {
|
||||||
|
private selected: tID|null = null;
|
||||||
|
|
||||||
|
protected onPick(id: tID|null) {
|
||||||
|
const timeline = this.$refs.timeline as Timeline;
|
||||||
|
if( timeline == null ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
timeline.filter(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
<h1 v-html='details.title'></h1>
|
<h1 v-html='details.title'></h1>
|
||||||
<h2>Featured in <b>{{ details.projects.length }}</b> {{ details.projects.length > 1 ? 'projects' : 'project' }}</h2>
|
<h2>Featured in <b>{{ details.projects.length }}</b> {{ details.projects.length > 1 ? 'projects' : 'project' }}</h2>
|
||||||
<h3>
|
<h3>
|
||||||
<template v-for='(proj, i) of details.projects'>
|
<template v-for='(proj) of details.projects'>
|
||||||
<a :key='proj.name' :href='"#p-" + proj.name'>
|
<a :key='"pick-" + proj.name' :href='"#p-" + proj.name'>
|
||||||
{{ proj.name }}
|
{{ proj.name }}
|
||||||
</a>
|
</a>
|
||||||
<span :key='proj.name'>, </span>
|
<span :key='proj.name'>, </span>
|
||||||
|
@ -90,11 +90,13 @@
|
||||||
if( picked ){ // select
|
if( picked ){ // select
|
||||||
this.sel = id;
|
this.sel = id;
|
||||||
this.loadDetails(id);
|
this.loadDetails(id);
|
||||||
|
this.$emit('pick', id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// deselect
|
// deselect
|
||||||
this.sel = null;
|
this.sel = null;
|
||||||
this.details = null;
|
this.details = null;
|
||||||
|
this.$emit('pick', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onTag(t: string, picked: boolean){
|
protected onTag(t: string, picked: boolean){
|
||||||
|
|
|
@ -145,6 +145,14 @@
|
||||||
header.classList.remove('fixed');
|
header.classList.remove('fixed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public filter(skill: tID|null) {
|
||||||
|
if( skill == null ){
|
||||||
|
this.projects = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.projects = projects.bySkill(skill);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue