| @@ -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) { |