Skip to content

Commit 59e11bf

Browse files
authored
Add navbar
Add navbar
2 parents 0471ea7 + be48911 commit 59e11bf

File tree

7 files changed

+716
-51
lines changed

7 files changed

+716
-51
lines changed

public/js/app.js

Lines changed: 650 additions & 36 deletions
Large diffs are not rendered by default.

resources/js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("./bootstrap");
22

33
import { createApp } from "vue";
44

5-
import NewComponent from "./components/NewComponent.vue";
5+
import MainIndex from "./components/MainIndex.vue";
66

77
createApp({
8-
components: { NewComponent },
8+
components: { MainIndex },
99
}).mount("#app");
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<template>
2+
<div>
3+
<header class="text-gray-700 body-font">
4+
<div
5+
class="container flex flex-col flex-wrap items-center p-5 mx-auto md:flex-row"
6+
>
7+
<a
8+
class="flex items-center mb-4 font-medium text-gray-900 title-font md:mb-0"
9+
>
10+
<svg
11+
xmlns="http://www.w3.org/2000/svg"
12+
fill="none"
13+
stroke="currentColor"
14+
stroke-linecap="round"
15+
stroke-linejoin="round"
16+
stroke-width="2"
17+
class="w-10 h-10 p-2 text-white bg-indigo-500 rounded-full"
18+
viewBox="0 0 24 24"
19+
>
20+
<path
21+
d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"
22+
></path>
23+
</svg>
24+
<span class="ml-3 text-xl">Shopping Cart</span>
25+
</a>
26+
<nav
27+
class="flex flex-wrap items-center justify-center text-base md:mr-auto md:ml-4 md:py-1 md:pl-4 md:border-l md:border-gray-400"
28+
>
29+
<router-link
30+
class="mr-5 hover:text-gray-900"
31+
:to="{ name: 'products.index' }"
32+
>
33+
Products
34+
</router-link>
35+
</nav>
36+
<router-link
37+
class="inline-flex items-center px-3 py-1 mt-4 text-base bg-gray-200 border-0 rounded focus:outline-none hover:bg-gray-300 md:mt-0"
38+
:to="{ name: 'order.checkout' }"
39+
>
40+
Checkout<span class="inline-block ml-1"></span>
41+
</router-link>
42+
</div>
43+
</header>
44+
</div>
45+
</template>
46+
47+
<script>
48+
export default {
49+
name: "Navbar",
50+
};
51+
</script>
52+
53+
<style scoped>
54+
header {
55+
max-width: 1400px;
56+
}
57+
</style>

resources/js/components/LoadingSpinner/LoadingSpinner.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="container mx-auto">
3-
<h1 class="h-32 mt-24 text-5xl text-center animate-bounce text-bold">
3+
<h1 class="h-32 mt-24 text-3xl text-center animate-bounce text-bold">
44
Loading products ...
55
</h1>
66
</div>
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div>
3-
Vue
3+
<nav-bar />
4+
Laravel Vue 3 Ecommerce
45
<loading-spinner v-if="loading" />
56
<div v-if="products">
67
<div v-for="product in products" :key="product.id">
@@ -12,10 +13,11 @@
1213
</template>
1314

1415
<script>
16+
import NavBar from "./Header/Navbar";
1517
import LoadingSpinner from "./LoadingSpinner/LoadingSpinner";
1618
1719
export default {
18-
components: { LoadingSpinner },
20+
components: { LoadingSpinner, NavBar },
1921
data() {
2022
return {
2123
loading: true,

resources/views/welcome.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@endif
2727

2828
<div id="app">
29-
<new-component></new-component>
29+
<main-index />
3030
</div>
3131
<script src="{{ mix('js/app.js') }}"></script>
3232
</body>

tests/Browser/BuyProductTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,7 @@ public function testWeSeeVue()
1717
{
1818
$this->browse(function (Browser $browser) {
1919
$browser->visit('http://127.0.0.1:8000')
20-
->assertSee('Vue');
21-
});
22-
}
23-
24-
public function testWeDoNotSeeLaravel()
25-
{
26-
$this->browse(function (Browser $browser) {
27-
$browser->visit('http://127.0.0.1:8000')
28-
->assertDontSee('Laravel');
20+
->assertSee('Laravel Vue 3 Ecommerce');
2921
});
3022
}
3123
}

0 commit comments

Comments
 (0)