Skip to content

Commit e78efda

Browse files
committed
Update
1 parent 72c3827 commit e78efda

7 files changed

Lines changed: 151 additions & 11 deletions

File tree

.github/img/banner.svg

Lines changed: 134 additions & 0 deletions
Loading
File renamed without changes.

assets/css/styles.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,10 +1262,6 @@ svg {
12621262
color: rgb(12 74 110 / var(--tw-text-opacity));
12631263
}
12641264

1265-
.opacity-60 {
1266-
opacity: 0.6;
1267-
}
1268-
12691265
.shadow-xl {
12701266
--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
12711267
--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);

assets/icons/logo.svg

Lines changed: 6 additions & 0 deletions
Loading

src/Helpers.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,23 @@ public static function returnJson(array $data): string {
136136
/**
137137
* Get svg icon from file.
138138
*
139-
* @param string $icon
140-
* @param int $size
139+
* @param string $icon
140+
* @param ?int $size
141+
* @param ?string $class
141142
*
142143
* @return ?string
143144
*/
144-
public static function svg(string $icon, int $size = 16): ?string {
145+
public static function svg(string $icon, ?int $size = 16, ?string $class = null): ?string {
145146
$file = __DIR__.'/../assets/icons/'.$icon.'.svg';
146147

147148
if (is_file($file)) {
148149
$content = trim(file_get_contents($file));
149150
preg_match('~<svg([^<>]*)>~', $content, $attributes);
150151

151-
return preg_replace('~<svg([^<>]*)>~', '<svg'.$attributes[1].' width="'.$size.'" height="'.$size.'">', $content);
152+
$size_attr = $size ? ' width="'.$size.'" height="'.$size.'"' : '';
153+
$class_attr = $class ? ' class="'.$class.'"' : '';
154+
155+
return preg_replace('~<svg([^<>]*)>~', '<svg'.$attributes[1].$size_attr.$class_attr.'>', $content);
152156
}
153157

154158
return null;

templates/layout.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<aside id="sidebar" class="hidden md:block">
1212
<nav class="block fixed top-0 left-0 bottom-0 overflow-y-auto overflow-hidden w-64 bg-{{ color }}-500 shadow-xl shadow-gray-500 py-4 pt-6 px-6">
1313
<div class="min-h-full px-0 w-full mx-auto">
14-
<a class="block pb-2 text-left text-white text-lg font-bold hidden md:block" href="index.php">phpCacheAdmin</a>
14+
<a class="pb-2 text-white hidden md:block" href="index.php">{{ svg('logo', null) }}</a>
1515
{% for link, title in nav %}
1616
<a class="block py-2 text-white hover:text-gray-200{{ current == link ? ' font-bold' : '' }}" href="?type={{ link }}">
17-
<span class="mr-1 opacity-60">{{ svg(link) }}</span> {{ title }}
17+
<span class="mr-1">{{ svg(link) }}</span> {{ title }}
1818
</a>
1919
{% endfor %}
2020
<footer class="text-center text-white my-4">

templates/partials/info_table.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</tr>
5050
{% else %}
5151
<tr>
52-
<td colspan="2"><img class="mx-auto h-20 w-20" src="assets/icons/loading.svg" alt="Loading..."></td>
52+
<td colspan="2">{{ svg('loading', null, 'block mx-auto h-20 w-20') }}</td>
5353
</tr>
5454
{% endif %}
5555
</tbody>

0 commit comments

Comments
 (0)