Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Updating icon names #666

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/Icon/Service/IconService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

final class IconService implements IconServiceInterface
{
private string $defaultIcon = 'file-question-02';
private string $defaultIcon = 'unknown';

public function getIconForAsset(string $assetType, ?string $mimeType): ElementIcon
{
if ($assetType === 'document' && $mimeType !== null) {
$value = match ($mimeType) {
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'presentation-chart-01',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'file-x-03',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'file-02',
'application/pdf' => 'file-check-02',
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'presentation',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx-csv',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'txt-docs',
'application/pdf' => 'pdf',
default => $this->defaultIcon
};

Expand All @@ -41,10 +41,10 @@ public function getIconForAsset(string $assetType, ?string $mimeType): ElementIc

if ($assetType === 'text' && $mimeType !== null) {
$value = match ($mimeType) {
'application/json' => 'file-code-01',
'application/type9' => 'file-check-02',
'text/plain' => 'file-02',
'text/csv' => 'file-x-03',
'application/json' => 'json',
'application/type9' => 'pdf',
'text/plain' => 'txt-docs',
'text/csv' => 'xlsx-csv',
default => $this->defaultIcon
};

Expand All @@ -53,9 +53,9 @@ public function getIconForAsset(string $assetType, ?string $mimeType): ElementIc

$value = match ($assetType) {
'folder' => 'folder',
'image' => 'image-01',
'video' => 'video-recorder',
'audio' => 'volume-max',
'image' => 'image',
'video' => 'video',
'audio' => 'audio',
default => $this->defaultIcon
};

Expand All @@ -69,8 +69,8 @@ public function getIconForDataObject(DataObjectSearchResultItem $dataObject): El
}

$value = match ($dataObject->getType()) {
ElementTypes::TYPE_OBJECT => 'mainObject',
ElementTypes::TYPE_VARIANT => 'mainObjectVariant',
ElementTypes::TYPE_OBJECT => 'data-object',
ElementTypes::TYPE_VARIANT => 'data-object-variant',
ElementTypes::TYPE_FOLDER => 'folder',
default => $this->defaultIcon
};
Expand All @@ -80,7 +80,7 @@ public function getIconForDataObject(DataObjectSearchResultItem $dataObject): El

public function getIconForTag(): string
{
return 'tag-02';
return 'tag';
}

public function getIconForLayout(?string $iconPath): ?ElementIcon
Expand Down
Loading