Skip to content

Commit

Permalink
Add SelectAge page. Add router links
Browse files Browse the repository at this point in the history
  • Loading branch information
Psirex committed Apr 27, 2018
1 parent 1b3cbb8 commit 13d2b17
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 56 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dependencies": {
"lodash": "^4.17.10",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
"vue-router": "^3.0.1",
"vue-touch": "next"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ h1 {
.container {
max-width: 375px;
padding: 0 30px;
padding: 0 20px;
margin: 0 auto;
}
</style>
4 changes: 2 additions & 2 deletions src/layouts/NavigationLayout.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<div class="container" :style="{paddingTop: topImage ? '20px' : '0'}" >
<img v-if="topImage" :src="topImage" class="top">
<NavigationControls :back="true" :menu="true" />
<NavigationControls :back="back" :menu="menu" />
<slot />
</div>
</template>

<script>
import NavigationControls from '@/components/NavigationControls'
export default {
props: ['topImage'],
props: ['topImage', 'back', 'menu'],
components: {
NavigationControls
}
Expand Down
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import Vue from 'vue'
import App from './App'
import router from './router'
import VueTouch from 'vue-touch'

Vue.config.productionTip = false

Vue.use(VueTouch, { name: 'v-touch' })

/* eslint-disable no-new */
new Vue({
el: '#app',
Expand Down
49 changes: 18 additions & 31 deletions src/pages/Cards.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
<template>
<div class="container">
<img src="@/assets/top.png" class="top">
<div class="navigation">
<img src="@/assets/back.png" alt="">
<img src="@/assets/big_dots.png" alt="">
</div>
<h1>Cavity Prevention</h1>
<Switcher :menuNames='menuNames'/>
<div class="cards">
<div class="content">
<div class="title">Introduction</div>
<div class="article">Article</div>
<div class="text">Lorem ipsum dolor sit amet,consectetur adipiscing elit sed eiusmod tempor</div>
<NavigationLayout :topImage="require('@/assets/top.png')" :back="true" :menu="true">
<div>
<h1>Cavity Prevention</h1>
<Switcher :menuNames='menuNames'/>
<div class="cards">
<div class="content">
<div class="title">Introduction</div>
<div class="article">Article</div>
<div class="text">Lorem ipsum dolor sit amet,consectetur adipiscing elit sed eiusmod tempor</div>
</div>
<img src='@/assets/card.png' class="card main">
<img src='@/assets/card.png' class="card one">
<img src='@/assets/card.png' class="card two">
<img src='@/assets/card.png' class="card three">
</div>
<img src='@/assets/card.png' class="card main">
<img src='@/assets/card.png' class="card one">
<img src='@/assets/card.png' class="card two">
<img src='@/assets/card.png' class="card three">
</div>
</div>
</NavigationLayout>
</template>


<script>
import NavigationLayout from '@/layouts/NavigationLayout'
import Switcher from '@/components/CoursesSwitcher'
export default {
data: () => ({
Expand All @@ -33,24 +31,13 @@ export default {
]
}),
components: {
Switcher
Switcher,
NavigationLayout
}
}
</script>

<style scoped lang='scss'>
.container {
position: relative;
padding-top: 20px;
.top {
position: absolute;
top: 0;
left: 0;
width: auto;
height: 13px;
}
}
.navigation {
display: flex;
Expand Down
31 changes: 18 additions & 13 deletions src/pages/Courses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,47 @@
</div>
<Switcher :menuNames="menuNames" />
<div class="courses_wrapper">
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/1.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
<div class="px-0">Cavity Prevention</div>
</div>
<div class="progress_bar"></div>
</div>
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/2.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
<div class="px-0">Baby Teeth</div>
</div>
<div class="progress_bar"></div>
</div>
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/3.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
<div class="px-0">Proper Brushing</div>
</div>
<div class="progress_bar"></div>
</div>
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/4.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
<div class="px-0">Prenatal Oral Care</div>
</div>
<div class="progress_bar"></div>
</div>
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/5.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
<div class="px-0">Sugary Sweets</div>
</div>
<div class="complete">Complete</div>
</div>
<div class="course">
<div @click="navigateToCourse" class="course">
<div class="course_top">
<img class="icon" src="@/assets/Courses/6.png" alt="">
<img class="dotts" src="@/assets/Courses/dotts.png" alt="">
Expand All @@ -60,13 +60,18 @@
<script>
import Switcher from '@/components/CoursesSwitcher'
export default {
data: () => ({
menuNames: [
'All',
'Ongoing',
'Completed'
]
}),
data: () => ({
menuNames: [
'All',
'Ongoing',
'Completed'
]
}),
methods: {
navigateToCourse() {
this.$router.push('/details')
}
},
components: {
Switcher
}
Expand Down
17 changes: 12 additions & 5 deletions src/pages/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,24 @@
<div class="name">Lessons</div>
</div>
</div>
<img class="download" src="@/assets/download_btn.png" alt="btn">
</div>
<div class="swipe_up">
<img class="arrow" src="@/assets/swipe_arrow.png" />
<p>Swipe up to see course contents</p>
<img @click="$router.go(-1)" class="download" src="@/assets/download_btn.png" alt="btn">
</div>
<v-touch @swipeup="handleSwipeTop">
<div class="swipe_up">
<img class="arrow" src="@/assets/swipe_arrow.png" />
<p>Swipe up to see course contents</p>
</div>
</v-touch>
</div>
</template>

<script>
export default {
methods: {
handleSwipeTop () {
this.$router.push('/cards')
}
}
}
</script>

Expand Down
109 changes: 109 additions & 0 deletions src/pages/SelectAge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<template>
<NavigationLayout :back="true" :menu="true">
<h1> Age Group </h1>
<div class="content">
<div
class="avatar"
:style="{ backgroundImage: `url(${require('@/assets/characters/character-girl-3.png')}` }"
>
</div>
<div class="age-buttons">
<div
:class="getButtonClassName(1)"
@click="handleButtonClick(1)"
>
3-5 years
</div>
<div
:class="getButtonClassName(2)"
@click="handleButtonClick(2)"
>
5-7 years
</div>
<div
:class="getButtonClassName(3)"
@click="handleButtonClick(3)"
>
7-10 years
</div>
<div
:class="getButtonClassName(4)"
@click="handleButtonClick(4)"
>
10+ years
</div>
</div>
<ComponentButton @click="$router.push('/courses')">Continue </ComponentButton>
</div>
</NavigationLayout>
</template>

<script>
import NavigationLayout from '@/layouts/NavigationLayout'
import ComponentButton from '@/components/Button'
export default {
data () {
return {
selected: null
}
},
methods: {
getButtonClassName (number) {
return ['age-button', number === this.selected ? 'age-button--selected' : '']
},
handleButtonClick (number) {
this.selected = number
}
},
components: {
NavigationLayout,
ComponentButton
}
}
</script>

<style>
.content {
display: flex;
align-items: center;
flex-direction: column;
}
.avatar {
margin: 30px 0;
box-sizing: border-box;
border-radius: 50%;
box-shadow: rgba(255, 255, 255, 0.12 ) 0 0 0 8px;
width: 130px;
height: 130px;
background-position: 50% 15px;
background-size: contain;
background-repeat: no-repeat;
overflow: hidden;
background-color: #FFEBAE;
}
.age-buttons {
display: flex;
flex-wrap: wrap;
margin-bottom: 40px;
}
.age-button {
font-family: 'Gotham';
text-transform: uppercase;
background-color: #2E4A6E;
border-radius: 50px;
padding: 29px 22px 18px 22px;
width: 150px;
text-align: center;
margin: 0 auto;
margin-top: 30px;
color: #FFFFFF;
}
.age-button--selected {
background-color: #278ab5;
}
</style>
2 changes: 1 addition & 1 deletion src/pages/SelectCharacter.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<NavigationLayout>
<NavigationLayout :back="true" :menu="true">
<h1>Select A Character</h1>
<div>
<div
Expand Down
6 changes: 6 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Details from '@/pages/Details'
import Cards from '@/pages/Cards'
import Login from '@/pages/Login'
import SelectCharacter from '@/pages/SelectCharacter'
import SelectAge from '@/pages/SelectAge'

Vue.use(Router)

Expand Down Expand Up @@ -40,6 +41,11 @@ export default new Router({
path: '/select-character',
name: 'SelectCharacter',
component: SelectCharacter
},
{
path: '/select-age',
name: 'SelectAge',
component: SelectAge
}
]
})
Loading

0 comments on commit 13d2b17

Please sign in to comment.