Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👌 IMPROVE: Add card options class-img-top/class-img-bottom #92

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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