|
22 | 22 |
|
23 | 23 | {%- macro vf_card(columns="2", link=None, heading=None, image=None, author=None, date=None, footer=None, description=None) -%} |
24 | 24 |
|
25 | | -{%- set layout = 'p-content-card--' ~ columns ~ '-cols' -%} |
| 25 | +{%- set col_str = columns | string -%} |
| 26 | +{%- set layout = 'p-content-card--cols-' ~ col_str -%} |
26 | 27 | {%- set img_class = 'has-image' if image else '' -%} |
27 | 28 | {%- set has_desc = 'has-desc' if description else '' -%} |
28 | 29 |
|
29 | | -<div class="p-content-card {{ layout }} {{ img_class }} {{ has_desc }}"> |
30 | | - |
31 | | - {%- if link -%} |
32 | | - <a href="{{ link }}" class="p-content-card__overlay-link" tabindex="-1" aria-hidden="true"></a> |
33 | | - {%- endif -%} |
| 30 | +<div class="p-content-card-wrapper p-content-card-wrapper--{{ col_str }}"> |
| 31 | + |
| 32 | + <div class="p-content-card {{ layout }} {{ img_class }} {{ has_desc }}"> |
| 33 | + |
| 34 | + {%- if link -%} |
| 35 | + <a href="{{ link }}" class="p-content-card__overlay-link" tabindex="-1" aria-hidden="true"></a> |
| 36 | + {%- endif -%} |
34 | 37 |
|
35 | | - {%- if image -%} |
36 | | - <div class="p-content-card__image-wrapper"> |
37 | | - <img class="p-content-card__image" src="{{ image.src }}" alt="{{ image.alt }}" /> |
38 | | - </div> |
39 | | - {%- endif -%} |
| 38 | + {%- if image -%} |
| 39 | + <div class="p-content-card__image-wrapper"> |
| 40 | + <img class="p-content-card__image" src="{{ image.src }}" alt="{{ image.alt }}" /> |
| 41 | + </div> |
| 42 | + {%- endif -%} |
40 | 43 |
|
41 | | - <div class="p-content-card__content"> |
42 | | - <div class="p-content-card__body"> |
43 | | - |
44 | | - <div class="p-content-card__primary-content"> |
45 | | - <h4 class="p-content-card__heading"> |
46 | | - {%- if link -%} |
47 | | - <a href="{{ link }}" class="p-content-card__main-link">{{ heading }}</a> |
48 | | - {%- else -%} |
49 | | - {{ heading }} |
50 | | - {%- endif -%} |
51 | | - </h4> |
| 44 | + <div class="p-content-card__content"> |
| 45 | + <div class="p-content-card__body"> |
52 | 46 |
|
53 | | - {%- if image and (author or date) -%} |
54 | | - <div class="p-content-card__author-and-date u-sv-3"> |
55 | | - <small> |
56 | | - {%- if author -%} |
57 | | - <span class="u-text--muted">{{ author }}</span> |
58 | | - {%- endif -%} |
59 | | - |
60 | | - {%- if author and date -%} |
61 | | - · |
62 | | - {%- endif -%} |
63 | | - |
64 | | - {%- if date -%} |
65 | | - <span class="u-text--muted">{{ date }}</span> |
| 47 | + <div class="p-content-card__primary-content"> |
| 48 | + <h4 class="p-content-card__heading"> |
| 49 | + {%- if link -%} |
| 50 | + <a href="{{ link }}" class="p-content-card__main-link">{{ heading }}</a> |
| 51 | + {%- else -%} |
| 52 | + {{ heading }} |
66 | 53 | {%- endif -%} |
67 | | - </small> |
| 54 | + </h4> |
| 55 | + |
| 56 | + {%- if image and (author or date) -%} |
| 57 | + <div class="p-content-card__author-and-date u-sv-3"> |
| 58 | + <small> |
| 59 | + {%- set items = [] -%} |
| 60 | + {%- if author -%}{%- set _ = items.append('<span class="u-text--muted">' ~ author ~ '</span>') -%}{%- endif -%} |
| 61 | + {%- if date -%}{%- set _ = items.append('<span class="u-text--muted">' ~ date ~ '</span>') -%}{%- endif -%} |
| 62 | + {{ items | join(' · ') | safe }} |
| 63 | + </small> |
| 64 | + </div> |
| 65 | + {%- endif -%} |
| 66 | + </div> |
| 67 | + |
| 68 | + {%- if description -%} |
| 69 | + <div class="p-content-card__hover-content"> |
| 70 | + <p class="p-content-card__description">{{ description }}</p> |
68 | 71 | </div> |
69 | 72 | {%- endif -%} |
70 | | - </div> |
71 | 73 |
|
72 | | - {%- if description -%} |
73 | | - <div class="p-content-card__hover-content"> |
74 | | - <p class="p-content-card__description">{{ description }}</p> |
75 | 74 | </div> |
76 | | - {%- endif -%} |
77 | | - |
78 | | - </div> |
79 | | - |
80 | | - {%- if footer -%} |
81 | | - <div> |
82 | | - <hr class="p-rule--muted"> |
83 | | - <div class="p-content-card__footer-outer"> |
84 | | - <div class="p-content-card__footer-inner" tabindex="-1"> |
85 | | - {%- if footer.resource_type -%} |
86 | | - <span class="u-has-icon"> |
87 | | - <i class="p-content-card__icon p-icon--{{ footer.resource_type.icon }}"></i> |
88 | | - <small class="p-content-card__small">{{ footer.resource_type.text }}</small> |
89 | | - </span> |
90 | | - {%- endif -%} |
| 75 | + |
| 76 | + {%- if footer -%} |
| 77 | + <div class="p-content-card__footer-container"> |
| 78 | + <hr class="p-rule--muted"> |
| 79 | + <div class="p-content-card__footer-outer"> |
| 80 | + <div class="p-content-card__footer-inner" tabindex="-1"> |
| 81 | + {%- if footer.resource_type -%} |
| 82 | + <span class="u-has-icon"> |
| 83 | + <i class="p-content-card__icon p-icon--{{ footer.resource_type.icon }}"></i> |
| 84 | + <small class="p-content-card__small">{{ footer.resource_type.text }}</small> |
| 85 | + </span> |
| 86 | + {%- endif -%} |
91 | 87 |
|
92 | | - {%- if footer.content_type %} |
93 | | - <span class="p-chip--information is-readonly">{{ footer.content_type}}</span> |
94 | | - {%- endif -%} |
| 88 | + {%- if footer.content_type %} |
| 89 | + <span class="p-chip--information is-readonly">{{ footer.content_type }}</span> |
| 90 | + {%- endif -%} |
| 91 | + </div> |
95 | 92 | </div> |
96 | 93 | </div> |
| 94 | + {%- endif -%} |
97 | 95 | </div> |
98 | | - {%- endif -%} |
99 | 96 | </div> |
100 | 97 | </div> |
101 | 98 | {%- endmacro -%} |
0 commit comments