<template>
	<div id="app">
		<Home/>
		<SkillPicker ref='picker'   @pick='onPick($event)'/>
		<Timeline    ref='timeline' @pick='onPicked($event)'/>
		<Footer/>
	</div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { tID } from '@/model/skills';
import Home from './components/Home.vue';
import Timeline from './components/Timeline.vue';
import SkillPicker from './components/SkillPicker.vue';
import Footer from './components/Footer.vue';


@Component({
	components: {
		Home,
		Timeline,
		SkillPicker,
		Footer,
	},
})
export default class App extends Vue {
	// skill picker selection -> filters the timeline
	protected onPick(id: tID|null) {
		const timeline = this.$refs.timeline as Timeline;
		if ( timeline == null ) {
			return;
		}
		timeline.filter(id);
	}

	// skill picked from the timeline -> select on the skill picker
	protected onPicked(id: tID) {
		const picker = this.$refs.picker as SkillPicker;
		if ( picker == null ) {
			return;
		}
		picker.select(id, false);
	}

	private mounted() {
		const picker = this.$refs.picker as SkillPicker;
		if ( picker == null ) {
			return;
		}
		picker.select(0, true);
	}

}
</script>

<style lang="scss">
	#app {
		display: flex;
		position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			min-height: 100%;
			height: auto;


		font-size: 1rem;
		font-family: 'Source Sans Pro', sans-serif;
		flex-flow: column nowrap;

		overflow: hidden;

		background: #fff;
	}

	a, a:visited {
		display: inline-block;
		position: relative;
		color: #cbcbcb;

		cursor: pointer;

		transition: color .2s ease-in-out;

		&::after {
			content: '';

			display: block;
			position: absolute;
				margin-left: 0%;
				width: 100%;
				height: .1em;

			background: #5f50bf;

			transition: width .2s ease-in-out, margin-left .2s ease-in-out;

			transform-style: preserve-3d;
		}

		&:hover{
			color: #fff;

			&::after {
				width: 104%;
			}
		}
	}
</style>
