chore: complete update
This commit is contained in:
40
src/Domain/Media/ImageSize.php
Normal file
40
src/Domain/Media/ImageSize.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
enum ImageSize: string
|
||||
{
|
||||
case SMALL = 'small';
|
||||
case MEDIUM = 'medium';
|
||||
case LARGE = 'large';
|
||||
case XLARGE = 'xlarge';
|
||||
|
||||
public function getWidth(ImageVariantType $type): int
|
||||
{
|
||||
return match ([$type, $this]) {
|
||||
[ImageVariantType::THUMBNAIL, self::SMALL] => 150,
|
||||
[ImageVariantType::THUMBNAIL, self::MEDIUM] => 300,
|
||||
|
||||
[ImageVariantType::GALLERY, self::SMALL] => 400,
|
||||
[ImageVariantType::GALLERY, self::MEDIUM] => 800,
|
||||
[ImageVariantType::GALLERY, self::LARGE] => 1200,
|
||||
|
||||
[ImageVariantType::HERO, self::SMALL] => 768,
|
||||
[ImageVariantType::HERO, self::MEDIUM] => 1024,
|
||||
[ImageVariantType::HERO, self::LARGE] => 1920,
|
||||
[ImageVariantType::HERO, self::XLARGE] => 2560,
|
||||
|
||||
default => throw new \InvalidArgumentException("Invalid combination: {$type->value} - {$this->value}"),
|
||||
};
|
||||
}
|
||||
|
||||
public function getBreakpoint(): ?int
|
||||
{
|
||||
return match ($this) {
|
||||
self::SMALL => 768,
|
||||
self::MEDIUM => 1024,
|
||||
self::LARGE => 1920,
|
||||
self::XLARGE => null, // Keine Breakpoint-Beschränkung
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user