Skip to content

Commit 5bc9d6b

Browse files
authored
Merge pull request #600 from howdu/howdu-document-image-custom-icon-size
Add ability for custom icon size in document image component
2 parents 30bf1da + 7833363 commit 5bc9d6b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

resources/views/components/document-image.blade.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@
66
])
77

88
@php
9-
$iconClasses = [
9+
$iconClass = match ($iconSize) {
1010
'sm' => 'w-4 h-4',
1111
'md' => 'w-6 h-6',
1212
'lg' => 'w-16 h-16',
1313
'xl' => 'w-24 h-24',
14-
];
14+
default => $iconSize,
15+
} . ' opacity-20';
1516
@endphp
1617

1718
<div @class([
1819
'curator-document-image grid place-items-center w-full h-full text-xs uppercase relative',
1920
$attributes->get('class')
2021
])>
2122
@if (str($type)->contains('video'))
22-
@svg('heroicon-o-video-camera', ['class' => 'opacity-20 ' . $iconClasses[$iconSize]])
23+
@svg('heroicon-o-video-camera', $iconClass)
2324
<span class="block absolute">{{ $extension }}</span>
2425
@else
25-
@svg('heroicon-o-document', ['class' => 'opacity-20 ' . $iconClasses[$iconSize]])
26+
@svg('heroicon-o-document', $iconClass)
2627
<span class="block absolute">{{ $extension }}</span>
2728
@endif
2829
<span class="sr-only">{{ $label }}</span>

0 commit comments

Comments
 (0)