Files
nova-design-system/src/components/Icons/upload/upload.astro
T

28 lines
940 B
Plaintext
Raw Normal View History

---
import upload16 from './svgs/upload-16.svg?raw';
import upload24 from './svgs/upload-24.svg?raw';
import upload32 from './svgs/upload-32.svg?raw';
export interface Props {
size: 16 | 24 | 32;
label?: string;
class?: string;
}
const { size = 24, label, class: className } = Astro.props;
let raw: string;
if (size === 16 ) raw = upload16;
else if (size === 24 ) raw = upload24;
else if (size === 32 ) raw = upload32;
else raw = ''; // Fallback to a blank string if no match is found, though this should not happen due to the type constraints on size.
const classes = ['nds-icon-upload', className].filter(Boolean).join(' ');
const svg = raw
.replace(/fill="#[A-Fa-f0-9]{3,8}"/g, 'fill="currentColor"')
.replace('<svg ', `<svg class="${classes}" aria-hidden="${label ? 'false' : 'true'}" ${label ? `aria-label="${label}" role="img"` : ''} `);
---
<Fragment set:html={svg} />