Dismissing the cart summary
We probably don't want the cart summary to take up too much of the screen space unnecessarily, so we should add a way to hide it. Rather than just dismissing it altogether, let's give the user a way to minimize and maximize it. In Chapter 4, Engaging users with interactive AMP components, we saw how to show or hide arbitrary HTML elements with the Action and Event model. We can apply the same approach here to give the user a way to show or hide the cart summary.
We'll add show and hide buttons just inside the submit-success container. These will be just like the ones we used to expand and collapse the amp-accordion, also in Chapter 4. We'll also attach some actions to the tap event of the <div class="cart-price" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access