Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit 34442b6

Browse files
authored
Merge pull request #28 from IIM-Creative-Technology/feature/23-front-end-overall
Add create project button and createProject method
2 parents 2068319 + 3048e5d commit 34442b6

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ yarn-error.log*
3232
.turbo
3333

3434
# editor
35-
.idea
35+
.idea

apps/web/pages/projects/index.vue

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
33
const { data: projects } = await useAsyncData('projects', () => $fetch('http://localhost:3001/projects'));
44
5+
const createProject = async () => {
6+
await useFetch('http://localhost:3001/projects', {
7+
method: 'POST',
8+
headers: { 'Content-Type': 'application/json' },
9+
body: { name: 'First project' },
10+
});
11+
};
512
// const projects = ref([
613
// { id: 1, name: 'First title', users: [{ name: 'Colin' }, { name: 'Florent' }] },
714
// { id: 2, name: 'Second title', users: [{ name: 'Colin' }] },
@@ -11,21 +18,34 @@ const { data: projects } = await useAsyncData('projects', () => $fetch('http://l
1118
</script>
1219

1320
<template>
14-
<div class="flex">
15-
<NuxtLink
16-
v-for="(project, index) in projects"
17-
:key="index"
18-
:to="`/projects/${project.id}`"
19-
>
20-
<div class="card w-96 bg-secondary-content shadow-xl">
21-
<div class="card-body">
22-
<h2 class="card-title">
23-
{{ project.name }}
24-
</h2>
25-
<p>{{ project.users.map(user => user.name).join(', ') }}</p>
21+
<div class="block">
22+
<div class="navbar bg-base-100">
23+
<div class="navbar-start">
24+
<div class="dropdown">
25+
<label tabindex="0" class="btn btn-ghost lg:hidden" />
2626
</div>
27+
<a class="btn btn-ghost normal-case text-xl">Live kanban</a>
2728
</div>
28-
</NuxtLink>
29+
<div class="navbar-end">
30+
<a class="btn" @click.prevent="createProject">Create project</a>
31+
</div>
32+
</div>
33+
<div class="flex flex-col items-center gap-5 mt-10">
34+
<NuxtLink
35+
v-for="(project, index) in projects"
36+
:key="index"
37+
:to="`/projects/${project.id}`"
38+
>
39+
<div class="card w-96 bg-secondary-content shadow-xl">
40+
<div class="card-body">
41+
<h2 class="card-title">
42+
{{ project.name }}
43+
</h2>
44+
<p>{{ project.users.map(user => user.name).join(', ') }}</p>
45+
</div>
46+
</div>
47+
</NuxtLink>
48+
</div>
2949
</div>
3050
</template>
3151
<script setup>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)