Skip to content

Commit fe9720b

Browse files
Modified banner from static image to carousel, added default router exeptionHandler.
1 parent 226520f commit fe9720b

File tree

9 files changed

+118
-35
lines changed

9 files changed

+118
-35
lines changed

src/App.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616

1717
<script lang="ts">
1818
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
19-
// import NavBar from '@/pages/generic/nav_bar/NavBar.vue';
2019
import CoreCta from '@/pages/generic/cta/Cta.vue';
2120
import CoreDrawer from '@/pages/generic/drawer/Drawer.vue';
2221
import CoreFooter from '@/pages/generic/footer/Footer.vue';
2322
import CoreToolbar from '@/pages/generic/toolbar/Toolbar.vue';
24-
// import CoreView from '@/pages/generic/nav_bar/NavBar.vue';
2523
2624
@Component({ components: { CoreCta, CoreDrawer, CoreFooter, CoreToolbar } })
2725
export default class App extends Vue {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2+
3+
export interface Item {
4+
src: string;
5+
title ? : string;
6+
displayWording ? : string;
7+
button ? : button;
8+
}
9+
10+
export interface button {
11+
displayWording: string;
12+
color: 'primary' | 'secondary';
13+
}
14+
15+
@Component({ inheritAttrs: false })
16+
export default class BaseCarousel extends Vue {
17+
@Prop({ required: true }) items!: Item[];
18+
19+
private createDisplayImage(item: Item): NodeRequire | string | undefined {
20+
if (item === null || item === undefined) return;
21+
22+
switch (item.src.charAt(0)) {
23+
case '@': {
24+
return require('@/' + item.src.substr(2, item.src.length));
25+
}
26+
case '.': {
27+
return require('./' + item.src.substr(2, item.src.length));
28+
}
29+
default: {
30+
return item.src;
31+
}
32+
};
33+
}
34+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<v-carousel cycle
3+
hide-delimiter-background>
4+
<v-carousel-item v-for="(item,i) in items"
5+
:key="i"
6+
height="400"
7+
width="100%"
8+
:src="createDisplayImage(item)"
9+
reverse-transition="fade-transition"
10+
transition="fade-transition">
11+
<v-row align="center"
12+
class="pa-3 fill-height">
13+
<v-col cols="4"
14+
sm="12"
15+
md="7"
16+
offset-md="5">
17+
<h1 v-if="item.title"
18+
class="display-3 font-weight-light">
19+
{{ item.title }}
20+
</h1>
21+
<div v-if="item.displayWording"
22+
class="subheading text-uppercase pl-2 mb-4">
23+
{{ item.displayWording }}
24+
</div>
25+
<v-btn v-if="item.button"
26+
:color="item.button.color"
27+
depressed
28+
rounded>
29+
{{ item.button.displayWording }}
30+
</v-btn>
31+
</v-col>
32+
</v-row>
33+
</v-carousel-item>
34+
</v-carousel>
35+
</template>
36+
<script lang="ts"
37+
src="./Carousel.ts" />

src/pages/PageNotFound.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<div>404 Page</div>
3+
</template>
4+
5+
<script lang="ts">
6+
import { Component, Vue } from 'vue-property-decorator';
7+
8+
@Component({
9+
components: {}
10+
})
11+
export default class extends Vue {};
12+
</script>

src/pages/home/banner/Banner.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
import { Component, Vue } from 'vue-property-decorator';
2+
import { Item } from '@/components/base/carousel/Carousel';
23

34
@Component
4-
export default class Banner extends Vue {};
5+
export default class Banner extends Vue {
6+
private items: Item[] = [{
7+
title: 'The Art Of Travel',
8+
displayWording: 'Finding Beauty, One flight at a time',
9+
src: '@/assets/articles/blurcamera.jpg',
10+
button: {
11+
displayWording: 'Subscribe',
12+
color: 'primary'
13+
}
14+
},
15+
{
16+
src: 'https://cdn.vuetifyjs.com/images/carousel/sky.jpg'
17+
},
18+
{
19+
src: 'https://cdn.vuetifyjs.com/images/carousel/bird.jpg'
20+
},
21+
{
22+
src: 'https://cdn.vuetifyjs.com/images/carousel/planet.jpg'
23+
}
24+
]
25+
};

src/pages/home/banner/Banner.vue

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
1+
import Carousel from '@/components/base/carousel/Carousel.vue';
12
<template>
23
<base-card dark>
3-
<v-img class="grey lighten-2"
4-
height="400"
5-
width="100%"
6-
:src="require('@/assets/articles/blurcamera.jpg')">
7-
<v-row align="center"
8-
class="pa-3 fill-height">
9-
<v-col cols="4"
10-
sm="12"
11-
md="7"
12-
offset-md="5">
13-
<h1 class="display-3 font-weight-light">
14-
The Art Of Travel
15-
</h1>
16-
<div class="subheading text-uppercase pl-2 mb-4">
17-
Finding Beauty, One flight at a time
18-
</div>
19-
<v-btn color="primary"
20-
depressed
21-
rounded>
22-
Subscribe
23-
</v-btn>
24-
</v-col>
25-
</v-row>
26-
</v-img>
4+
<base-carousel :items="items">
5+
</base-carousel>
276
</base-card>
287
</template>
298

src/plugins/base_components/baseComponents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import LargeBtn from '@/components/base/button/LargeBtn.vue';
33
import SmallBtn from '@/components/base/button/SmallBtn.vue';
44
import BaseCard from '@/components/base/card/Card.vue';
55
import BaseSubheading from '@/components/base/subheading/Subheading.vue';
6+
import BaseCarousel from '@/components/base/carousel/Carousel.vue';
67

78
Vue.component(LargeBtn.name, LargeBtn);
89
Vue.component(SmallBtn.name, SmallBtn);
910
Vue.component(BaseCard.name, BaseCard);
1011
Vue.component(BaseSubheading.name, BaseSubheading);
12+
Vue.component(BaseCarousel.name, BaseCarousel);

src/plugins/router/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue';
22
import VueRouter, { RouteConfig } from 'vue-router';
33
import { IRouterCustOpt, routerOptions } from './routerrc';
44
import Home from '@/pages/Home.vue';
5-
5+
import PageNotFound from '@/pages/PageNotFound.vue';
66
Vue.use(VueRouter);
77

88
const routes: RouteConfig[] = [{
@@ -20,7 +20,13 @@ for (let index in routeConfs) {
2020
if (routeConfs[index] !== null) {
2121
routes.push(routeConfs[index]);
2222
}
23+
2324
}
25+
routes.push({
26+
path: '*',
27+
name: 'pageNotFound',
28+
component: PageNotFound
29+
});
2430

2531
// Getting all configurations from 'router.json'.
2632
function createRouteConfigs (routerrcs: IRouterCustOpt[]): RouteConfig[] {

src/plugins/router/routerrc.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface IRouterCustOpt {
44
name: string;
55
webpackChunkName: string;
66
sourcePath: string;
7-
children?: IRouterCustOpt;
7+
children ? : IRouterCustOpt;
88
}
99

1010
export const routerOptions: IRouterCustOpt[] = [{
@@ -18,11 +18,5 @@ export const routerOptions: IRouterCustOpt[] = [{
1818
'name': 'login',
1919
'webpackChunkName': 'generic',
2020
'sourcePath': 'pages/login/Login.vue'
21-
},
22-
{
23-
'path': '*',
24-
'name': 'exceptionCather',
25-
'webpackChunkName': 'exception',
26-
'sourcePath': 'pages/Home.vue'
2721
}
2822
];

0 commit comments

Comments
 (0)