Skip to content

Commit

Permalink
👌 IMPROVE: Add card options class-img-top/class-img-bottom (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Aug 22, 2022
1 parent 782b9cb commit 1ef7449
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,9 @@ class-title

class-footer
: Additional CSS classes for the footer element.

class-img-top
: Additional CSS classes for the top image (if present).

class-img-bottom
: Additional CSS classes for the bottom image (if present).
6 changes: 4 additions & 2 deletions sphinx_design/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class CardDirective(SphinxDirective):
"class-body": directives.class_option,
"class-title": directives.class_option,
"class-footer": directives.class_option,
"class-img-top": directives.class_option,
"class-img-bottom": directives.class_option,
}

def run(self) -> List[nodes.Node]:
Expand Down Expand Up @@ -113,7 +115,7 @@ def create_card(
"",
uri=options["img-top"],
alt="card-img-top",
classes=["sd-card-img-top"],
classes=["sd-card-img-top"] + options.get("class-img-top", []),
)
container.append(image_top)

Expand Down Expand Up @@ -154,7 +156,7 @@ def create_card(
"",
uri=options["img-bottom"],
alt="card-img-bottom",
classes=["sd-card-img-bottom"],
classes=["sd-card-img-bottom"] + options.get("class-img-bottom", []),
)
container.append(image_bottom)

Expand Down

0 comments on commit 1ef7449

Please sign in to comment.