PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.2.0
Tableberg – Simple Gutenberg Table Block v1.2.0
1.2.0 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 All 43 releases
← All changes | renderer/Button/ButtonRenderer.php +13 -3 1.1.2 → 1.2.0 View file →
@@ -18,13 +18,18 @@
18 18 $textHoverColor = $attrs->styles->textHoverColor->isNotEmpty()
19 19 ? $attrs->styles->textHoverColor->asAttr()
20 20 : $textColor;
21 21
22 + // Outline draws the button's colour as its text and border with
23 + // nothing behind it, the way the core Buttons block does; hover then
24 + // fills it in, which is where the text colour comes back.
25 + $isOutline = $attrs->styles->variant->equals('outline');
26 +
22 27 $wrapperStyles = [
23 28 'display:flex',
24 29 'justify-content:' . $this->alignment_to_justify_content($attrs->align->asText()),
25 - '--tableberg-button-background-color:' . $backgroundColor,
26 - '--tableberg-button-text-color:' . $textColor,
30 + '--tableberg-button-background-color:' . ($isOutline ? 'transparent' : $backgroundColor),
31 + '--tableberg-button-text-color:' . ($isOutline ? $backgroundColor : $textColor),
27 32 '--tableberg-button-hover-background-color:' . $backgroundHoverColor,
28 33 '--tableberg-button-text-hover-color:' . $textHoverColor,
29 34 ];
30 35
@@ -29,10 +34,10 @@
29 34 ];
30 35
31 36 $buttonStyles = [
32 37 'display:inline-block',
38 + 'border:' . ($isOutline ? '2px solid ' . $backgroundColor : 'none'),
33 39 'text-align:' . $attrs->styles->textAlign->asAttr(),
34 - 'font-size:' . $attrs->styles->fontSize->asAttr(),
35 40 'padding-top:' . $attrs->styles->padding->top->asAttr(),
36 41 'padding-right:' . $attrs->styles->padding->right->asAttr(),
37 42 'padding-bottom:' . $attrs->styles->padding->bottom->asAttr(),
38 43 'padding-left:' . $attrs->styles->padding->left->asAttr(),
@@ -40,8 +45,13 @@
40 45 'border-top-right-radius:' . $attrs->styles->borderRadius->topRight->asAttr(),
41 46 'border-bottom-right-radius:' . $attrs->styles->borderRadius->bottomRight->asAttr(),
42 47 'border-bottom-left-radius:' . $attrs->styles->borderRadius->bottomLeft->asAttr(),
43 48 ];
49 +
50 + // Without a size of its own the button takes the table's.
51 + if ($attrs->styles->fontSize->isNotEmpty()) {
52 + $buttonStyles[] = 'font-size:' . $attrs->styles->fontSize->asAttr();
53 + }
44 54
45 55 $customWidth = $this->get_custom_width($attrs->styles->width->asText());
46 56
47 57 if ($customWidth !== null) {