Add style for photos

This commit is contained in:
Luca Bosin
2023-08-24 23:11:50 +02:00
parent ca90df83e9
commit c3e571fcb8
8 changed files with 180 additions and 50 deletions

View File

@ -1,10 +1,33 @@
<script>
export let name = '';
name;
export let clazz = '';
export { clazz as class };
export let color = 'currentColor';
/** @type {string} */
export let mdi;
/** @type {number | string} */
export let size = 1;
let mdiOld = '';
let path = '';
$: {
loadIcon(mdi);
}
$: width = size ? (typeof size === 'number' || !Number.isNaN(Number(size)) ? `${size}em` : size) : '1em';
/**
* @param {string} mdi
*/
async function loadIcon(mdi) {
if (mdi === mdiOld) return;
path = (await import(`$lib/icons/${mdi}.js`)).default;
//path = icon.path;
}
</script>
<style>
</style>
<svg class={clazz} viewBox="0 0 24 24" style="width: {width}; height: {width}">
<path fill={color} d={path} />
</svg>