Skip to content

Commit 1ef7449

Browse files
authored
👌 IMPROVE: Add card options class-img-top/class-img-bottom (#92)
1 parent 782b9cb commit 1ef7449

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docs/cards.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,9 @@ class-title
283283

284284
class-footer
285285
: Additional CSS classes for the footer element.
286+
287+
class-img-top
288+
: Additional CSS classes for the top image (if present).
289+
290+
class-img-bottom
291+
: Additional CSS classes for the bottom image (if present).

sphinx_design/cards.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class CardDirective(SphinxDirective):
6868
"class-body": directives.class_option,
6969
"class-title": directives.class_option,
7070
"class-footer": directives.class_option,
71+
"class-img-top": directives.class_option,
72+
"class-img-bottom": directives.class_option,
7173
}
7274

7375
def run(self) -> List[nodes.Node]:
@@ -113,7 +115,7 @@ def create_card(
113115
"",
114116
uri=options["img-top"],
115117
alt="card-img-top",
116-
classes=["sd-card-img-top"],
118+
classes=["sd-card-img-top"] + options.get("class-img-top", []),
117119
)
118120
container.append(image_top)
119121

@@ -154,7 +156,7 @@ def create_card(
154156
"",
155157
uri=options["img-bottom"],
156158
alt="card-img-bottom",
157-
classes=["sd-card-img-bottom"],
159+
classes=["sd-card-img-bottom"] + options.get("class-img-bottom", []),
158160
)
159161
container.append(image_bottom)
160162

0 commit comments

Comments
 (0)