Merge pull request #891 from TetrisIQ/moveIconsInComunityRepo

Move icons in comunity repo
This commit is contained in:
Andras Bacsai 2023-02-17 13:00:02 +01:00 committed by GitHub
commit d122af9fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,25 +1,14 @@
<script lang="ts">
export let type: string;
export let isAbsolute = false;
let githubRawIconUrl =
'https://raw.githubusercontent.com/coollabsio/coolify-community-templates/main/services/icons';
let fallback = '/icons/default.png';
const handleError = (ev: { target: { src: string } }) => (ev.target.src = fallback);
let extension = 'png';
let svgs = [
'mattermost',
'directus',
'pocketbase',
'gitea',
'languagetool',
'meilisearch',
'n8n',
'glitchtip',
'searxng',
'umami',
'uptimekuma',
'vaultwarden',
'weblate',
'wordpress'
];
const handleError = (ev: { target: { src: string } }) => {
ev.target.src = fallback;
};
const name: any =
type &&
@ -29,32 +18,15 @@
.split('-')[0]
.toLowerCase();
if (svgs.includes(name)) {
extension = 'svg';
}
function generateClass() {
switch (name) {
case 'n8n':
if (isAbsolute) {
return 'w-12 h-12 absolute -m-9 -mt-12';
}
return 'w-12 h-12 -mt-3';
case 'weblate':
if (isAbsolute) {
return 'w-12 h-12 absolute -m-9 -mt-12';
}
return 'w-12 h-12 -mt-3';
default:
return isAbsolute ? 'w-10 h-10 absolute -m-4 -mt-9 left-0' : 'w-10 h-10';
}
return isAbsolute ? 'w-10 h-10 absolute -m-4 -mt-9 left-0' : 'w-10 h-10';
}
</script>
{#if name}
<img
class={generateClass()}
src={`/icons/${name}.${extension}`}
src={`${githubRawIconUrl}/${name}.png`}
on:error={handleError}
alt={`Icon of ${name}`}
/>