Add style for photos
This commit is contained in:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user