Skip to content

Commit

Permalink
馃帹 Moved cart functionality to the header.html template
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhanCitil committed Oct 5, 2023
1 parent 5ffbe1b commit 2a91a63
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/bobvance/templates/base/index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
{% extends 'master.html' %}
{% block content%}
{% include 'components/header.html'%}
<div :class="cartOpen ? 'translate-x-0 ease-out' : 'translate-x-full ease-in'" class="fixed right-0 top-0 max-w-xs w-full h-full px-6 py-4 transition duration-300 transform overflow-y-auto bg-white border-l-2 border-gray-300">
<div class="flex items-center justify-between">
<h3 class="text-2xl font-medium text-gray-700">Your cart</h3>
<button @click="cartOpen = !cartOpen" class="text-gray-600 focus:outline-none">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M6 18L18 6M6 6l12 12"></path></svg>
</button>
</div>
<div class="flex justify-between mt-6">
<div class="flex">
<img class="h-20 w-20 object-cover rounded" src="https://images.unsplash.com/photo-1593642632823-8f785ba67e45?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1189&q=80" alt="">
<div class="mx-3">
<h3 class="text-sm text-gray-600">Mac Book Pro</h3>
<div class="flex items-center mt-2">
<button class="text-gray-500 focus:outline-none focus:text-gray-600">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
</button>
<span class="text-gray-700 mx-2">2</span>
<button class="text-gray-500 focus:outline-none focus:text-gray-600">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
</button>
</div>
</div>
</div>
<span class="text-gray-600">20$</span>
</div>
<a class="flex items-center justify-center mt-4 px-3 py-2 bg-blue-600 text-white text-sm uppercase font-medium rounded hover:bg-blue-500 focus:outline-none focus:bg-blue-500">
<span>Chechout</span>
<svg class="h-5 w-5 mx-2" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg>
</a>
</div>

<main class="my-8">
<div class="container mx-auto px-6">
<div class="h-64 rounded-md overflow-hidden bg-cover bg-center" style="background-image: url('https://images.unsplash.com/photo-1577655197620-704858b270ac?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1280&q=144')">
Expand Down
32 changes: 32 additions & 0 deletions src/bobvance/templates/components/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,35 @@
</div>
</div>
</header>

<div :class="cartOpen ? 'translate-x-0 ease-out' : 'translate-x-full ease-in'" class="fixed right-0 top-0 max-w-xs w-full h-full px-6 py-4 transition duration-300 transform overflow-y-auto bg-white border-l-2 border-gray-300">
<div class="flex items-center justify-between">
<h3 class="text-2xl font-medium text-gray-700">Your cart</h3>
<button @click="cartOpen = !cartOpen" class="text-gray-600 focus:outline-none">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M6 18L18 6M6 6l12 12"></path></svg>
</button>
</div>
<div class="flex justify-between mt-6">
<div class="flex">
<img class="h-20 w-20 object-cover rounded" src="https://images.unsplash.com/photo-1593642632823-8f785ba67e45?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1189&q=80" alt="">
<div class="mx-3">
<h3 class="text-sm text-gray-600">Mac Book Pro</h3>
<div class="flex items-center mt-2">
<button class="text-gray-500 focus:outline-none focus:text-gray-600">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
</button>
<span class="text-gray-700 mx-2">2</span>
<button class="text-gray-500 focus:outline-none focus:text-gray-600">
<svg class="h-5 w-5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
</button>
</div>
</div>
</div>
<span class="text-gray-600">20$</span>
</div>
<a class="flex items-center justify-center mt-4 px-3 py-2 bg-blue-600 text-white text-sm uppercase font-medium rounded hover:bg-blue-500 focus:outline-none focus:bg-blue-500">
<span>Chechout</span>
<svg class="h-5 w-5 mx-2" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg>
</a>
</div>

0 comments on commit 2a91a63

Please sign in to comment.