Skip to content

Commit 4a8a5b7

Browse files
authored
Merge pull request #4 from ConstructFund/feature/router
fix: add correct router, link and icons
2 parents 4d44aa4 + b8cd152 commit 4a8a5b7

File tree

8 files changed

+119
-74
lines changed

8 files changed

+119
-74
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ coverage
2626
*.njsproj
2727
*.sln
2828
*.sw?
29+
codealike.json

package-lock.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@vueuse/core": "^10.1.2",
1313
"vite-plugin-vuetify": "^1.0.2",
1414
"vue": "^3.2.47",
15+
"vue-router": "^4.2.4",
1516
"vuetify": "^3.2.1",
1617
"webfontloader": "^1.6.28"
1718
},

src/App.vue

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,7 @@
11
<template>
22
<v-app dark>
33
<v-main>
4-
<v-toolbar app>
5-
<v-toolbar-title>Construct Fund</v-toolbar-title>
6-
<v-spacer></v-spacer>
7-
<v-btn text @click="reportIssue('_self')" @auxclick="reportIssue('_blank')">
8-
<v-icon right>mdi-open-in-new</v-icon>
9-
Report issue
10-
</v-btn>
11-
</v-toolbar>
12-
<div class="parent">
13-
<Card v-for="(item, i) in content" :key="i" :content="item"/>
14-
</div>
4+
<router-view></router-view>
155
</v-main>
166
</v-app>
177
</template>
18-
19-
<script setup>
20-
import Card from "@/components/Card.vue";
21-
import content from "@/assets/content.json";
22-
23-
function reportIssue(target) {
24-
window.open(
25-
"https://github.com/ConstructFund/constructfund.github.io/issues/",
26-
target);
27-
}
28-
</script>
29-
30-
<style scoped>
31-
.parent {
32-
width: 100%;
33-
height: calc(100% - 64px);
34-
overflow: auto;
35-
padding-left: 30%;
36-
padding-right: 30%;
37-
padding-top: 50px;
38-
padding-bottom: 50px;
39-
}
40-
41-
/* media query for mobile padding */
42-
@media (max-width: 700px) {
43-
.parent {
44-
padding-left: 20px;
45-
padding-right: 20px;
46-
}
47-
}
48-
49-
/* media query for small screen padding min width 801 */
50-
@media (min-width: 701px) and (max-width: 1200px) {
51-
.parent {
52-
padding-left: 10%;
53-
padding-right: 10%;
54-
}
55-
}
56-
57-
/* media query for small screen padding min width 801 */
58-
@media (min-width: 1201px) and (max-width: 1500px) {
59-
.parent {
60-
padding-left: 20%;
61-
padding-right: 20%;
62-
}
63-
}
64-
</style>

src/components/Card.vue

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
<v-spacer></v-spacer>
1010
<div v-if="content.hasWebsite">
1111
<v-btn
12-
@click="openWebsite('_self')"
13-
@auxclick="openWebsite('_blank')"
14-
variant="text"> Open Website </v-btn>
15-
<v-icon right>mdi-open-in-new</v-icon>
12+
:href="props.content.url"
13+
variant="text">
14+
Open Website
15+
<v-icon end>mdi-open-in-new</v-icon>
16+
</v-btn>
1617
</div>
1718
</v-toolbar>
1819
<div v-else>
@@ -33,7 +34,7 @@
3334
</v-sheet>
3435

3536
<v-sheet v-if="content.hasWebsite" width="100%" class="button">
36-
<v-btn @click="openWebsite('_self')" @auxclick="openWebsite('_blank')" variant="text" style="width: 100%">
37+
<v-btn :href="props.content.url" variant="text" style="width: 100%">
3738
Open Website
3839
</v-btn>
3940
</v-sheet>
@@ -44,13 +45,15 @@
4445
<v-card-actions>
4546
<div>
4647
<v-chip :color="chipColor">
47-
<div class="prechip">Status:</div>
48+
<div class="prechip">Status</div>
4849
{{ content.status }}
4950
</v-chip>
5051
</div>
5152
<div style="display: flex; flex-wrap: nowrap" v-if="content.hasRepo">
52-
<v-btn @click="openRepo('_self')" @auxclick="openRepo('_blank')">Open Repo</v-btn>
53-
<v-icon>mdi-github</v-icon>
53+
<v-btn :href="props.content.repo">
54+
Open Repo
55+
<v-icon end>mdi-github</v-icon>
56+
</v-btn>
5457
</div>
5558
</v-card-actions>
5659
</v-card>
@@ -76,14 +79,6 @@ const chipColor = computed(() => {
7679
});
7780
7881
const isMobile = useMediaQuery("(max-width: 700px)");
79-
80-
function openWebsite(target) {
81-
window.open(props.content.url, target);
82-
}
83-
84-
function openRepo(target) {
85-
window.open(props.content.repo, target);
86-
}
8782
</script>
8883

8984
<style scoped>

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import App from "./App.vue";
99
import "./assets/main.css";
1010

11+
import { router } from './router/router'
12+
1113
// Composables
1214
import { createApp } from "vue";
1315

@@ -18,4 +20,6 @@ const app = createApp(App);
1820

1921
registerPlugins(app);
2022

23+
app.use(router)
24+
2125
app.mount("#app");

src/pages/Home.vue

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<template>
2+
<v-toolbar app>
3+
<v-toolbar-title>Construct Fund</v-toolbar-title>
4+
<v-spacer></v-spacer>
5+
<v-btn text :href="issueURL">
6+
<v-icon start>mdi-open-in-new</v-icon>
7+
Report issue
8+
</v-btn>
9+
</v-toolbar>
10+
<div class="parent">
11+
<Card v-for="(item, i) in content" :key="i" :content="item"/>
12+
</div>
13+
</template>
14+
15+
<script setup>
16+
import Card from "@/components/Card.vue";
17+
import content from "@/assets/content.json";
18+
19+
const issueURL = "https://github.com/ConstructFund/constructfund.github.io/issues/"
20+
</script>
21+
22+
<style scoped>
23+
.parent {
24+
width: 100%;
25+
height: calc(100% - 64px);
26+
overflow: auto;
27+
padding-left: 30%;
28+
padding-right: 30%;
29+
padding-top: 50px;
30+
padding-bottom: 50px;
31+
}
32+
33+
/* media query for mobile padding */
34+
@media (max-width: 700px) {
35+
.parent {
36+
padding-left: 20px;
37+
padding-right: 20px;
38+
}
39+
}
40+
41+
/* media query for small screen padding min width 801 */
42+
@media (min-width: 701px) and (max-width: 1200px) {
43+
.parent {
44+
padding-left: 10%;
45+
padding-right: 10%;
46+
}
47+
}
48+
49+
/* media query for small screen padding min width 801 */
50+
@media (min-width: 1201px) and (max-width: 1500px) {
51+
.parent {
52+
padding-left: 20%;
53+
padding-right: 20%;
54+
}
55+
}
56+
</style>

src/router/router.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createRouter, createWebHistory } from 'vue-router'
2+
3+
const Home = () => import('../pages/Home.vue')
4+
5+
const routes = [
6+
{ path: '/', component: Home },
7+
]
8+
9+
export const router = createRouter({
10+
history: createWebHistory(),
11+
routes,
12+
})

0 commit comments

Comments
 (0)