98db7328cb
Added icons: - Arrow2Icon - BinIcon - BurgerIcon - CalendarIcon - CheckIcon - CloseIcon - CodeIcon - CubeIcon - DownloadIcon - FilterIcon - HelpIcon - HomeIcon - LinkIcon - MinusIcon - MoreIcon - OverviewIcon - PlusIcon - ProfileIcon - SearchIcon - SettingsIcon - ShareIcon - ShieldIcon - SortIcon - StatsIcon - UploadIcon Available sizes: - 16px - 24px - 32px SortIcon variants: - default - ascend - descend Notes: - Added a dedicated icon grid preview in the design system page - Verified consistency across all supported sizes
27 lines
773 B
Plaintext
27 lines
773 B
Plaintext
---
|
|
import code16 from './svgs/code-16.svg?raw';
|
|
import code24 from './svgs/code-24.svg?raw';
|
|
import code32 from './svgs/code-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 = code16;
|
|
else if (size === 24) raw = code24;
|
|
else if (size === 32) raw = code32;
|
|
else raw = '';
|
|
|
|
const classes = ['nds-icon-code', 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} />
|