svelte simple icons
v4.0.1
توفر هذه الحزمة Simple Icons 13.21.0 المعبأة كمجموعة من مكونات Svelte.
قم بتثبيت الحزمة في دليل المشروع الخاص بك باستخدام:
// with yarn
yarn add @icons-pack/svelte-simple-icons
// with npm
npm add @icons-pack/svelte-simple-icons
يتم استيراد كافة الرموز من ملف واحد، حيث يتم استبدال [ICON SLUG] برمز ثابت كبير.
تحرير الرموز وصندوق الرمل
<!-- Import a specific icon by its slug as: -->
<!-- import { Si[ICON SLUG] } from 'simple-icons'; -->
< script >
import { SiReact , SiSvelte , SiDocker } from " @icons-pack/svelte-simple-icons " ;
</ script >
< SiSvelte color = "#FF3E00" size ={ 90 } />
< SiReactJs color = "#61DAFB" size ={ 50 } />
< SiDocker />
<!-- title default "Svelte" -->
< script >
import { SiSvelte } from " @icons-pack/svelte-simple-icons " ;
</ script >
< SiSvelte title = " My title " />
< script >
import { SiSvelte } from " @icons-pack/svelte-simple-icons " ;
</ script >
< SiSvelte class = " myStyle " />
< style >
.myStyle {
width : 35 px ;
height : 35 px ;
}
</ style >
في بعض الأحيان، نريد توفير المكون ديناميكيًا لمكون ما. يمكننا القيام بذلك باستخدام ميزة svelte:component
مع تعريف نوع SiComponentType
من النوع المساعد.
< script lang = " ts " >
import type { SiComponentType } from ' @icons-pack/svelte-simple-icons ' ;
export let icon : SiComponentType ;
export let text : string ;
export let click : () => void = () => console . log ( ' do something ' );
</ script >
< button on:click ={ click }>
< svelte:component
this ={ icon }
title ={ text } <!-- optional , along with size and color properties -->
/>
{ text }
</ button >
< style lang = " scss " >
button {
display : flex ;
flex-direction : row ;
text-decoration : none ;
white-space : nowrap ;
transition : border-color 0.25 s ;
box-shadow : none ;
text-shadow : none ;
}
.icon {
margin : 4 px 4 px 0 0 ;
}
</ style >
إذا كنت تحتاج فقط إلى عدد قليل من الرموز، فيمكنك استيرادها بشكل فردي بدلاً من الملف بأكمله لتحسين عملية التجميع.
< script >
import SiSvelte from " @icons-pack/svelte-simple-icons/icons/SiSvelte.svelte " ;
import SiGithub from " @icons-pack/svelte-simple-icons/icons/SiGithub.svelte " ;
</ script >
< SiGithub />
< SiSvelte />