Refactor email content styles from string to array

[MAILPOET-5591]
This commit is contained in:
Jan Lysý
2023-10-18 19:45:26 +02:00
committed by Jan Lysý
parent 1250d81670
commit 5946884cb2
2 changed files with 40 additions and 15 deletions

View File

@@ -25,20 +25,46 @@ class StylesController {
* Default styles applied to the email. These are going to be replaced by style settings.
* This is currently more af a proof of concept that we can apply styles to the email.
* We will gradually replace these hardcoded values with styles saved as global styles or styles saved with the email.
* @var string
* @var array
*/
const DEFAULT_EMAIL_CONTENT_STYLES = "
body { font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }
p { font-size: 16px; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }
";
const DEFAULT_EMAIL_CONTENT_STYLES = [
'typography' => [
'fontFamily' => "Arial, 'Helvetica Neue', Helvetica, sans-serif",
'fontSize' => '16px',
],
'h1' => [
'typography' => [
'fontSize' => '32px',
],
],
'h2' => [
'typography' => [
'fontSize' => '24px',
],
],
'h3' => [
'typography' => [
'fontSize' => '18px',
],
],
'h4' => [
'typography' => [
'fontSize' => '16px',
],
],
'h5' => [
'typography' => [
'fontSize' => '14px',
],
],
'h6' => [
'typography' => [
'fontSize' => '12px',
],
],
];
public function getEmailContentStyles(): string {
public function getEmailContentStyles(): array {
return self::DEFAULT_EMAIL_CONTENT_STYLES;
}