Prepare styles in store for sidebar

[MAILPOET-5638]
This commit is contained in:
Jan Lysý
2024-02-28 19:17:17 +01:00
committed by Jan Lysý
parent 46e5576ddc
commit db8dac03d2
13 changed files with 71 additions and 57 deletions

View File

@ -94,26 +94,37 @@ class SettingsController {
}
/**
* @return array{width: string, background: string, padding: array{bottom: string, left: string, right: string, top: string}}
* @return array{
* layout: array{width: string,background: string,padding: array{bottom: string, left: string, right: string, top: string}},
* colors: array{background: string},
* typography: array[]
* }
*/
public function getEmailLayoutStyles(): array {
public function getEmailStyles(): array {
return [
'width' => self::EMAIL_WIDTH,
'background' => self::EMAIL_LAYOUT_BACKGROUND,
'padding' => [
'bottom' => self::FLEX_GAP,
'left' => self::FLEX_GAP,
'right' => self::FLEX_GAP,
'top' => self::FLEX_GAP,
'layout' => [
'background' => self::EMAIL_LAYOUT_BACKGROUND,
'width' => self::EMAIL_WIDTH,
'padding' => [
'bottom' => self::FLEX_GAP,
'left' => self::FLEX_GAP,
'right' => self::FLEX_GAP,
'top' => self::FLEX_GAP,
],
],
'colors' => [
'background' => '#000000',
],
'typography' => [
],
];
}
public function getLayoutWidthWithoutPadding(): string {
$layoutStyles = $this->getEmailLayoutStyles();
$width = $this->parseNumberFromStringWithPixels($layoutStyles['width']);
$width -= $this->parseNumberFromStringWithPixels($layoutStyles['padding']['left']);
$width -= $this->parseNumberFromStringWithPixels($layoutStyles['padding']['right']);
$layoutStyles = $this->getEmailStyles();
$width = $this->parseNumberFromStringWithPixels($layoutStyles['layout']['width']);
$width -= $this->parseNumberFromStringWithPixels($layoutStyles['layout']['padding']['left']);
$width -= $this->parseNumberFromStringWithPixels($layoutStyles['layout']['padding']['right']);
return "{$width}px";
}