Skip to content

Commit a7abf77

Browse files
committed
updated styling on symfony product component
1 parent 1581d5f commit a7abf77

2 files changed

Lines changed: 131 additions & 9 deletions

File tree

examples/dotcms-symfony/assets/styles/app.css

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,98 @@ nav ul ul {
382382
padding: 0.75rem 1rem 0.5rem 1rem;
383383
}
384384
}
385+
386+
/* Product Card Component - Structure matching Laravel with Symfony aesthetic */
387+
.product-card {
388+
background-color: white;
389+
border-radius: 0.5rem;
390+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
391+
overflow: hidden;
392+
margin-bottom: 1.5rem;
393+
}
394+
395+
.product-image-container {
396+
padding: 1rem;
397+
}
398+
399+
.product-image {
400+
width: 100%;
401+
max-height: 15rem; /* 240px - equivalent to max-h-60 */
402+
object-fit: contain;
403+
display: block;
404+
}
405+
406+
.product-content {
407+
padding: 1.5rem 1.5rem 1rem 1.5rem; /* px-6 py-4 equivalent */
408+
background-color: #f8fafc; /* Light gray background instead of slate-100 */
409+
}
410+
411+
.product-title {
412+
font-size: 1.25rem; /* 20px - equivalent to text-xl */
413+
font-weight: bold;
414+
color: #1f2937;
415+
margin-bottom: 0.5rem;
416+
line-height: 1.3;
417+
}
418+
419+
.product-pricing {
420+
margin-bottom: 1rem;
421+
}
422+
423+
.product-retail-price {
424+
color: #6b7280; /* Gray-500 */
425+
text-decoration: line-through;
426+
font-size: 1rem;
427+
margin-bottom: 0.25rem;
428+
}
429+
430+
.product-sale-price,
431+
.product-main-price {
432+
font-size: 1.875rem; /* 30px - equivalent to text-3xl */
433+
font-weight: bold;
434+
color: #1f2937;
435+
line-height: 1.2;
436+
}
437+
438+
.product-spacer {
439+
min-height: 1.5rem; /* 24px - equivalent to min-h-6 */
440+
}
441+
442+
.product-button {
443+
display: inline-block;
444+
background-color: #6b7280; /* Neutral gray instead of green to maintain Symfony identity */
445+
color: white;
446+
padding: 0.5rem 1rem;
447+
margin-top: 1rem;
448+
font-weight: 600;
449+
text-decoration: none;
450+
border-radius: 0.25rem;
451+
font-size: 0.875rem;
452+
transition: background-color 0.2s ease;
453+
}
454+
455+
.product-button:hover {
456+
background-color: #4b5563; /* Darker gray on hover */
457+
color: white;
458+
text-decoration: none;
459+
}
460+
461+
/* Responsive adjustments for product cards */
462+
@media (max-width: 768px) {
463+
.product-title {
464+
font-size: 1.125rem; /* Slightly smaller on mobile */
465+
}
466+
467+
.product-sale-price,
468+
.product-main-price {
469+
font-size: 1.5rem; /* Smaller on mobile */
470+
}
471+
472+
.product-content {
473+
padding: 1rem;
474+
}
475+
476+
.product-image {
477+
max-height: 12rem; /* Smaller image on mobile */
478+
}
479+
}
Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
{% if content.image %}
22
{% set imageHtml %}
33
<img src="{{ dotcms_host }}/dA/{{ content.identifier }}/image"
4-
alt="{{ content.title|default('')|e('html_attr') }}">
4+
alt="{{ content.title|default('')|e('html_attr') }}"
5+
class="product-image">
56
{% endset %}
67
{% endif %}
78

8-
<article>
9-
{{ imageHtml|default('')|raw }}
10-
<div>
11-
<h3>{{ content.title|default('') }}</h3>
12-
<div>{{ content.retailPrice|default('') }}</div>
13-
<div>{{ content.salePrice|default('') }}</div>
14-
<a href="/store/products/{{ content.urlTitle|default('#') }}">Buy Now</a>
9+
<div class="product-card">
10+
<div class="product-image-container">
11+
{% if content.image %}
12+
{{ imageHtml|raw }}
13+
{% endif %}
1514
</div>
16-
</article>
15+
<div class="product-content">
16+
<div class="product-title">{{ content.title|default('') }}</div>
17+
18+
<div class="product-pricing">
19+
{% set retailPrice = content.retailPrice|default('') %}
20+
{% set salePrice = content.salePrice|default('') %}
21+
22+
{% if retailPrice and salePrice %}
23+
<div class="product-retail-price">{{ retailPrice }}</div>
24+
<div class="product-sale-price">{{ salePrice }}</div>
25+
{% else %}
26+
<div class="product-spacer"></div>
27+
<div class="product-main-price">
28+
{% if retailPrice %}
29+
{{ retailPrice }}
30+
{% elseif salePrice %}
31+
{{ salePrice }}
32+
{% else %}
33+
$0.00
34+
{% endif %}
35+
</div>
36+
{% endif %}
37+
</div>
38+
39+
<a href="/store/products/{{ content.urlTitle|default('#') }}" class="product-button">
40+
Buy Now
41+
</a>
42+
</div>
43+
</div>

0 commit comments

Comments
 (0)