Skip to content

Commit 5892ead

Browse files
committed
L3 ending code
1 parent ccfae46 commit 5892ead

File tree

4 files changed

+97
-147
lines changed

4 files changed

+97
-147
lines changed

src/components/EventCard.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div class="event-card">
3+
<span>@{{ event.time }} on {{ event.date }}</span>
4+
<h4>{{ event.title }}</h4>
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
props: {
11+
event: {
12+
type: Array,
13+
required: true
14+
}
15+
}
16+
}
17+
</script>
18+
19+
<style scoped>
20+
.event-card {
21+
padding: 20px;
22+
width: 250px;
23+
cursor: pointer;
24+
border: 1px solid #39495c;
25+
margin-bottom: 18px;
26+
}
27+
.event-card h4 {
28+
font-size: 20px;
29+
}
30+
.event-card:hover {
31+
transform: scale(1.01);
32+
box-shadow: 0 3px 12px 0 rgba(0, 0, 0, 0.2);
33+
}
34+
</style>

src/components/HelloWorld.vue

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/router/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import { createRouter, createWebHistory } from "vue-router";
2-
import Home from "../views/Home.vue";
1+
import { createRouter, createWebHistory } from 'vue-router'
2+
import Home from '../views/Home.vue'
33

44
const routes = [
55
{
6-
path: "/",
7-
name: "Home",
6+
path: '/',
7+
name: 'Home',
88
component: Home
99
},
1010
{
11-
path: "/about",
12-
name: "About",
11+
path: '/about',
12+
name: 'About',
1313
// route level code-splitting
1414
// this generates a separate chunk (about.[hash].js) for this route
1515
// which is lazy-loaded when the route is visited.
1616
component: () =>
17-
import(/* webpackChunkName: "about" */ "../views/About.vue")
17+
import(/* webpackChunkName: "about" */ '../views/About.vue')
1818
}
19-
];
19+
]
2020

2121
const router = createRouter({
2222
history: createWebHistory(process.env.BASE_URL),
2323
routes
24-
});
24+
})
2525

26-
export default router;
26+
export default router

src/views/Home.vue

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,64 @@
11
<template>
2-
<div class="home">
3-
<img alt="Vue logo" src="../assets/logo.png" />
4-
<HelloWorld msg="Welcome to Your Vue.js App" />
2+
<div class="events">
3+
<EventCard v-for="event in events" :key="event.id" :event="event" />
54
</div>
65
</template>
76

87
<script>
98
// @ is an alias to /src
10-
import HelloWorld from "@/components/HelloWorld.vue";
9+
import EventCard from '@/components/EventCard.vue'
1110
1211
export default {
13-
name: "Home",
12+
name: 'Home',
1413
components: {
15-
HelloWorld
14+
EventCard
15+
},
16+
data() {
17+
return {
18+
events: [
19+
{
20+
id: 5928101,
21+
category: 'animal welfare',
22+
title: 'Cat Adoption Day',
23+
description: 'Find your new feline friend at this event.',
24+
location: 'Meow Town',
25+
date: 'January 28, 2022',
26+
time: '12:00',
27+
petsAllowed: true,
28+
organizer: 'Kat Laydee'
29+
},
30+
{
31+
id: 4582797,
32+
category: 'food',
33+
title: 'Community Gardening',
34+
description: 'Join us as we tend to the community edible plants.',
35+
location: 'Flora City',
36+
date: 'March 14, 2022',
37+
time: '10:00',
38+
petsAllowed: true,
39+
organizer: 'Fern Pollin'
40+
},
41+
{
42+
id: 8419988,
43+
category: 'sustainability',
44+
title: 'Beach Cleanup',
45+
description: 'Help pick up trash along the shore.',
46+
location: 'Playa Del Carmen',
47+
date: 'July 22, 2022',
48+
time: '11:00',
49+
petsAllowed: false,
50+
organizer: 'Carey Wales'
51+
}
52+
]
53+
}
1654
}
17-
};
55+
}
1856
</script>
57+
58+
<style scoped>
59+
.events {
60+
display: flex;
61+
flex-direction: column;
62+
align-items: center;
63+
}
64+
</style>

0 commit comments

Comments
 (0)