From 48a836c31286605883faa3d378c969082e4b197e Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Thu, 13 Apr 2023 04:47:24 -0400 Subject: [PATCH] fix: Add missing width, class-img-top, class-img-bottom options to grid-item-card (#115) Co-authored-by: Chris Holdgraf --- sphinx_design/grids.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sphinx_design/grids.py b/sphinx_design/grids.py index c67c344..a340d3d 100644 --- a/sphinx_design/grids.py +++ b/sphinx_design/grids.py @@ -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, @@ -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]: @@ -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", @@ -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