Skip to content

Commit

Permalink
fix: Add missing width, class-img-top, class-img-bottom options to gr…
Browse files Browse the repository at this point in the history
…id-item-card (#115)

Co-authored-by: Chris Holdgraf <[email protected]>
  • Loading branch information
jpmckinney and choldgraf authored Apr 13, 2023
1 parent 72eac96 commit 48a836c
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit 48a836c

Please sign in to comment.