3.1.4 • Published 2 years ago

tv-shopping-lib-npm v3.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Adding icons

In order to include a new icon we have a script to process the icons that removes unnecesary attrs and creates a React Component from svgs.

The steps to add a new icons are: 0- Name your iconName.svg with a short and descriptive file name and remember to prefix it with icon. The file name is used to create the icons as React Components. So, later will be use to invoque the icon: <IconName /> or <Icon name="name"> 1- Add the new iconName.svg into /iconsRaw 2- Execute the script yarn icons 3- Now you are able to use the icon as:

import { Icon } from 'tv-shopping-lib-npm'
import { IconCart } from 'tv-shopping-lib-npm'

const Example = () => {
  return <>
    <Icon name="cart" />
    <IconCart />
  </>
}

Components creation tips

  • Naming interfaces convention: I(interface) + name(component, function, ...) + Props(optional in case of input function parameters). For instance:
interface IButtonProps {
  focused: boolean
  variant: keyof IVariants
  ...
}
  • Naming Types convention: T(type) + name(component, function, prop name, ...). For example:
  type TSize = number | 'auto'
  • To style a focused component, use in styles ':focus' selector like this:
const componentExample = styled.div`
  ...
  &:focus {
    background-color: red;
  }
`

or the class name '.la-focused' like this:

const componentExample = styled.div`
  ...
  &.la-focused {
    background-color: red;
  }
`
  • Typescript + styled-components:
  interface TitleProps {
    readonly isActive: boolean;
  }

  const Title = styled.h1<TitleProps>`
    color: red;
  `;
3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.4

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

2.1.0-pre

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.7

2 years ago

2.1.0

2 years ago

2.0.1-pre.10

2 years ago

3.1.0

2 years ago

2.0.1-pre.9

2 years ago

2.0.1-pre.5

2 years ago

2.0.1-pre.6

2 years ago

2.0.1-pre.7

2 years ago

1.0.8

2 years ago

2.0.1-pre.8

2 years ago

1.0.7

2 years ago

2.0.1-pre.1

2 years ago

2.0.1-pre.2

2 years ago

2.0.1-pre.3

2 years ago

2.0.1-pre.4

2 years ago

1.0.6-pre.0

2 years ago

2.0.1-pre.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0-pre.20

2 years ago

1.0.0-pre.22

2 years ago

1.0.0-pre.21

2 years ago

1.0.0-pre.13

2 years ago

1.0.0-pre.12

2 years ago

1.0.0-pre.15

2 years ago

1.0.0-pre.14

2 years ago

1.0.0-pre.17

2 years ago

1.0.0-pre.16

2 years ago

1.0.0-pre.19

2 years ago

1.0.0-pre.18

2 years ago

1.0.0-pre.11

2 years ago

1.0.0-pre.10

2 years ago

1.0.0-pre.9

2 years ago

1.0.0-pre.8

2 years ago

1.0.0-pre.7

2 years ago

1.0.0-pre.6

2 years ago

1.0.0-pre.5

2 years ago

1.0.0-pre.4

2 years ago

1.0.0-pre.1

2 years ago

1.0.0-pre.0

2 years ago