Skip to content
Merged
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
12 changes: 10 additions & 2 deletions sphinx_design/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class GridItemCardDirective(SphinxDirective):
"columns": item_columns_option,
"margin": margin_option,
"padding": padding_option,
"class-item": directives.class_option,
# The options below must be sync'ed with CardDirective.option_spec (minus margin).
"width": make_choice(["auto", "25%", "50%", "75%", "100%"]),
"text-align": text_align,
"img-background": directives.uri,
"img-top": directives.uri,
Expand All @@ -224,12 +227,13 @@ class GridItemCardDirective(SphinxDirective):
"link-type": make_choice(["url", "any", "ref", "doc"]),
"link-alt": directives.unchanged,
"shadow": make_choice(["none", "sm", "md", "lg"]),
"class-item": directives.class_option,
"class-card": directives.class_option,
"class-body": directives.class_option,
"class-title": directives.class_option,
"class-header": 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 @@ -257,6 +261,7 @@ def run(self) -> List[nodes.Node]:
for key, value in self.options.items()
if key
in [
"width",
"text-align",
"img-background",
"img-top",
Expand All @@ -270,9 +275,12 @@ def run(self) -> List[nodes.Node]:
"class-title",
"class-header",
"class-footer",
"class-img-top",
"class-img-bottom",
]
}
card_options["width"] = "100%"
if "width" not in card_options:
card_options["width"] = "100%"
card_options["margin"] = []
card = CardDirective.create_card(self, self.arguments, card_options)
column += card
Expand Down