diff --git a/src/components/auctions/Index.vue b/src/components/auctions/Index.vue index eca22af..5af5149 100644 --- a/src/components/auctions/Index.vue +++ b/src/components/auctions/Index.vue @@ -1,7 +1,9 @@ @@ -40,7 +54,9 @@ function formatPrice(price) { - {{ auction.name }} + + {{ auction.name }} + {{ formatPrice(auction.currentBid || auction.startingPrice) }} diff --git a/src/components/auctions/ShowDialog.vue b/src/components/auctions/ShowDialog.vue new file mode 100644 index 0000000..d577e7a --- /dev/null +++ b/src/components/auctions/ShowDialog.vue @@ -0,0 +1,45 @@ + + + + + + + {{currentAuction.name}} + + Bid + Cancel + + + + + + + \ No newline at end of file diff --git a/src/components/auctions/current_auction_store.js b/src/components/auctions/current_auction_store.js new file mode 100644 index 0000000..09e7238 --- /dev/null +++ b/src/components/auctions/current_auction_store.js @@ -0,0 +1,12 @@ +import { atom } from "nanostores"; + +export const $currentAuction = atom(null); + +export function setAuction(data) { + $currentAuction.set(data) +} + +export function resetAuction(path) { + history.pushState(null, null, path) + $currentAuction.set(null) +} \ No newline at end of file diff --git a/src/components/auctions/scripts/current_auction_store_history.js b/src/components/auctions/scripts/current_auction_store_history.js new file mode 100644 index 0000000..24ec074 --- /dev/null +++ b/src/components/auctions/scripts/current_auction_store_history.js @@ -0,0 +1,6 @@ +import {setAuction} from "../current_auction_store.js"; + +window.addEventListener('popstate', (event) => { + let {state} = event + setAuction(state) +}) \ No newline at end of file diff --git a/src/pages/auctions.astro b/src/pages/auctions.astro index 3e87df6..e9723ab 100644 --- a/src/pages/auctions.astro +++ b/src/pages/auctions.astro @@ -2,10 +2,13 @@ import Layout from '../layouts/Layout.astro'; import Auctions from '../components/auctions/Index.vue' +import AuctionShowDialog from '../components/auctions/ShowDialog.vue' --- - + + + \ No newline at end of file
{{ formatPrice(auction.currentBid || auction.startingPrice) }}