Skip to content

Commit 48a836c

Browse files
fix: Add missing width, class-img-top, class-img-bottom options to grid-item-card (#115)
Co-authored-by: Chris Holdgraf <choldgraf@gmail.com>
1 parent 72eac96 commit 48a836c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sphinx_design/grids.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ class GridItemCardDirective(SphinxDirective):
216216
"columns": item_columns_option,
217217
"margin": margin_option,
218218
"padding": padding_option,
219+
"class-item": directives.class_option,
220+
# The options below must be sync'ed with CardDirective.option_spec (minus margin).
221+
"width": make_choice(["auto", "25%", "50%", "75%", "100%"]),
219222
"text-align": text_align,
220223
"img-background": directives.uri,
221224
"img-top": directives.uri,
@@ -224,12 +227,13 @@ class GridItemCardDirective(SphinxDirective):
224227
"link-type": make_choice(["url", "any", "ref", "doc"]),
225228
"link-alt": directives.unchanged,
226229
"shadow": make_choice(["none", "sm", "md", "lg"]),
227-
"class-item": directives.class_option,
228230
"class-card": directives.class_option,
229231
"class-body": directives.class_option,
230232
"class-title": directives.class_option,
231233
"class-header": directives.class_option,
232234
"class-footer": directives.class_option,
235+
"class-img-top": directives.class_option,
236+
"class-img-bottom": directives.class_option,
233237
}
234238

235239
def run(self) -> List[nodes.Node]:
@@ -257,6 +261,7 @@ def run(self) -> List[nodes.Node]:
257261
for key, value in self.options.items()
258262
if key
259263
in [
264+
"width",
260265
"text-align",
261266
"img-background",
262267
"img-top",
@@ -270,9 +275,12 @@ def run(self) -> List[nodes.Node]:
270275
"class-title",
271276
"class-header",
272277
"class-footer",
278+
"class-img-top",
279+
"class-img-bottom",
273280
]
274281
}
275-
card_options["width"] = "100%"
282+
if "width" not in card_options:
283+
card_options["width"] = "100%"
276284
card_options["margin"] = []
277285
card = CardDirective.create_card(self, self.arguments, card_options)
278286
column += card

0 commit comments

Comments
 (0)