@s-ui/svg

3.24.0 • Public • Published

sui-svg

Converts your SVG files into React Components wrapped with @s-ui/atom-icon.

Features:

  • Building the components
  • Showing up a demo locally

Installation

$ npm i -SE @s-ui/svg

Usage

Add bundling scripts to your package.json

{
  "name": "my-awesome-package",
  "version": "1.0.0",
  "scripts": {
    "prepublishOnly": "sui-svg build",
    "start": "npm run prepare && sui-svg demo"
  }
}

Expected folder structure

A src folder with all the .svg files to be converted inside.

Output

A lib folder with the generated components will be created/overridden.

⚠️ Advice: no index.js will be generated inside the lib folder, each component should be imported independently for performance reasons.

How to use the generated lib

import YourIcon from 'your-svg-repo/lib/YourIcon'

const YourAwesomeComponent = () =>
  <div>
    <YourIcon />
    <p>Awesome text/<p>
  </div>

Also, keep in mind, you need to import the needed styles for the icons at least once in your app:

@import 'your-svg-repo/lib/index';

Template

Every icon svg will be wrapped using an <AtomIcon> that means you could use all the props accepted by the component.

The wrapped code is minimal, in order to avoid performance penalties. You could check it here.

/@s-ui/svg/

    Package Sidebar

    Install

    npm i @s-ui/svg

    Weekly Downloads

    1,560

    Version

    3.24.0

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • daniel.perez.ext
    • albert.peiro
    • frandelacasa-adevinta
    • mariapaula.forero.ext
    • hpintos_adevinta
    • sziauberyte
    • victor.perez.adevinta
    • oscar-raig-adevinta
    • carlos.gonzalezl
    • carolina.mallo.ext
    • david.nieto
    • ferran.simon
    • xavi_conejo
    • sergi.quintela
    • jamile.radloff
    • xavi_ballestar
    • luz_adv
    • ignacio.rodriguez
    • carlosvillu-adevinta
    • diegomr
    • arturo.vicente
    • adria.velardos
    • emiliovz
    • dann41
    • ruben-martin
    • pol.valls
    • cristina.rodriguez.duque
    • sergio.escano
    • marc.benito
    • azahara
    • patricio.sartore
    • giovanny.sayas.ext
    • david.cuadrado.ext
    • alex.castells
    • beatrizip
    • pablo.rey-adevinta
    • sergiocollado
    • mango.sanchezredondo
    • cristhianb
    • alisa_bayanova
    • davidmartin2108
    • ferrangbtw
    • estefania_garcia
    • belen.santos
    • alfredo.arronte
    • joanleon-adv
    • giodelabarrera.adevinta
    • luis-garrido
    • aitor.rodriguez
    • jordi.munoz
    • oscar_ramirez
    • ignacio_navarro
    • a.ferrer
    • gfabregoadv
    • izeller
    • salvador.juan
    • oriol.egea
    • ivanmlaborda
    • alejandro.ferrante
    • pa.chruscinski.ext
    • isabelgomez87
    • jenifer.lopez
    • daniela.aguilera
    • pablogs
    • javier.miguel
    • oscar.gomez
    • marian.lucaci
    • alverd004
    • oriol.puig
    • nacho_torrella
    • xavi.murcia
    • chloe.leteinturier
    • javiauso
    • alfredo.zimperz
    • francisco.ruiz.lloret
    • fermin.adevinta
    • andresadv
    • schibstedspain