You've already forked wc-bootstrap
Implement Phase 9 & reusable components; skip Phase 8 (emails)
Phase 8 (Emails) skipped: WooCommerce email rendering uses wc_get_template_html() which bypasses the Twig pipeline entirely. Email customization deferred to plugins or block email editor. Phase 9 - Supplementary (7 templates): - Brand description with thumbnail, taxonomy archive delegate - Brands A-Z shortcode with alphabetical index navigation - Single brand thumbnail shortcode - REST API OAuth login and grant-access forms - Back-in-stock notification form with email input Reusable Components (6 templates): - price: product price display with sale handling - rating: star rating with Bootstrap Icons (filled/half/empty) - address-card: billing/shipping address card with edit link - status-badge: contextual order status badges - quantity-input: +/- input group widget - form-field: universal form field renderer (text/select/textarea/checkbox) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
58
templates/components/address-card.html.twig
Normal file
58
templates/components/address-card.html.twig
Normal file
@@ -0,0 +1,58 @@
|
||||
{#
|
||||
# Address Card Component (Bootstrap 5)
|
||||
#
|
||||
# Reusable address display card with optional edit link.
|
||||
#
|
||||
# Expected context:
|
||||
# title - Card header title (e.g., "Billing address")
|
||||
# address - Formatted address HTML string
|
||||
# phone - Phone number (optional)
|
||||
# email - Email address (optional)
|
||||
# edit_url - URL to edit this address (optional)
|
||||
#
|
||||
# Usage:
|
||||
# {% include 'components/address-card.html.twig' with {
|
||||
# title: 'Billing address',
|
||||
# address: order.get_formatted_billing_address(),
|
||||
# phone: order.get_billing_phone(),
|
||||
# email: order.get_billing_email(),
|
||||
# edit_url: wc_get_endpoint_url('edit-address', 'billing')
|
||||
# } %}
|
||||
#
|
||||
# @package WcBootstrap
|
||||
# @since 0.1.0
|
||||
#}
|
||||
|
||||
<div class="card h-100">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h3 class="h6 mb-0">{{ title|esc_html }}</h3>
|
||||
{% if edit_url is defined and edit_url %}
|
||||
<a href="{{ edit_url|esc_url }}" class="btn btn-sm btn-outline-primary">
|
||||
<i class="bi bi-pencil me-1" aria-hidden="true"></i>{{ __('Edit') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<address class="mb-0" style="font-style: normal; line-height: 1.6;">
|
||||
{% if address %}
|
||||
{{ address|wp_kses_post }}
|
||||
{% else %}
|
||||
<span class="text-body-secondary">{{ __('N/A') }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if phone is defined and phone %}
|
||||
<p class="mt-2 mb-0">
|
||||
<i class="bi bi-telephone me-1" aria-hidden="true"></i>
|
||||
{{ phone|esc_html }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if email is defined and email %}
|
||||
<p class="mt-1 mb-0">
|
||||
<i class="bi bi-envelope me-1" aria-hidden="true"></i>
|
||||
{{ email|esc_html }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user