0.4.53 • Published 3 years ago

simply-react-ui-components v0.4.53

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

simply-react-ui-components

A Simple and Minimalist React Components Library

NPM JavaScript Style Guide

Install

This library needs the tailwindcss stylesheet to work

npm install --save simply-react-ui-components tailwindcss

Usage

We need to wrap our App into SimplyUIProvider to config some thinigs as the Link component that we're going to use to move around our application.

Provider

import { SimplyUIProvider } from 'simply-react-ui-components'
import 'tailwindcss/dist/tailwind.min.css';
import Link from 'next/Link';

export default function App() {
  return (
    <SimplyUIProvider Link={Link} library="nextjs">
      <MyApp />
    </SimplyUIProvider>
  )
}

Properties

nameTypeDescription
LinkString, node or functionSet the Link element that is going to be used to move in the application. Default: 'a'
libraryStringIf your going to use an extra library like NextJS, this is were you need to specify it. Default: undefined

Components

I'm starting this development as a hobby so feel free to make changes and I'll review them to merge with the main project.

Button

The Button component has just necessary to look good and work good taking the role of a simply button or a Link, if you use an internal Link the it's going to use Link component provided at SimplyUIProvider, otherwhise it's going to use an a tag.

import { Button } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <>
      <Button
        background="e53e3e"
        color="white"
        href="/contact"
      >
        Let's start
      </Button>
    </>
  )
}

Properties

NameTypeDescription
childrenReactNodeContent from the button, you can pass just a string or a whole component if you want something like an icon with the text or something like that.
onClickfunctionThe function to trigger when button it's clicked. Default: () => {}.
hrefStringThe path which you're going to be moved when button it's clicked if you want to. Default: undefined
background StringColor background of the button. Default: undefined
colorStringColor of the text of the button in case that you pass only a String as children. Default: undefined
roundedBoolean or StringThis is to add rounded courners to Button. Default: undefined
classNameStringIf you want to add a class to add margin or something. Default: undefined

Header

The Header component has a couple but useful personalizations, like keep header items on small devices, add a shadow when exists scroll, change the background when there's no scroll and when there's is.

import { Header } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <>
      <Header
        title="Simply"
        position="fixed"
        shadow="onScroll"
        items={[
          {
            label: "Blog",
            button: {
              rounded: true
            }
          }
        ]}
      />
    </>
  )
}

Properties

NameTypeDescription
positionStringDefine the Header position. Default: 'relative'
titleString or functionDefine the Header title, usually is the platfform name, allow you to pass a function to fully personalize this part. Default: ''
shadowBoolean, Object or StringThis enable a small elevation, can be shown when there's scroll or always, also let you set a custom shadow to match your background. Default: false
backgroundString or objectSet the Header background, allow to set a static solid background, a translucent background or even a background who changes depending on scroll. Default: undefined
colorString or objectSet the color from label items, allow you to set a static value, a value from labels and title or event an initial color and a scroll color for both, title and labels. Default: undefined
itemsArrayHere you can set the header item labels like a blog label or a sign in button. The array must receive objects with a label item, allow you to set an href or onClick action also accepts the button item to make item look like a button. Default: []
sidebarButtonBoolean, function or StringChoose if you want to display a sidebar button always, only in small devices or big devices, also allow you to pass a function to fully customize the sidebar button, when you use a function, the function receive this values to let you interact with header internal state: isSidebarOpen, setIsSidebarOpen, scrolled. Default: false
hideItemsOnSmallDevicesBooleanThis let the header items intact even in small devices, in false then the items will hide on small devices. Default: true
withCartObject, Boolean or StringShow a cart icon if true, show a cart icon with link if value is a String. Also have the possibility to show it only on specific screen size. Default: false
cartCountNumberThis allow you to display a count of the items in the cart. Default: undefined
sidebarStateBooleanSync internal state with external. Default: undefined

Sidebar

The Sidebar component has the necessary to create a simple menu and / or display header items on small devices.

import { useState } from 'react'
import { Sidebar } from 'simply-react-ui-components'

export default function Layout() {
  const [isSidebarOpen] = useState(false)

  return (
    <Sidebar
      isOpen={isSidebarOpen}
      position="fixed"
      items={[
        {
          label: 'Services'
        }
      ]}
    />
  )
}

Properties

NameTypeDescription
isOpenBooleanThis set if sidebar should be visible in the case that position is fixed or absolute. Default: true
backgroundStringSet the Sidebar backgrund color. Default: undefined
shadowColorStringIf your page background it's black by example, you can use this to modify the current shadow-box property of the Sidebar to achieve a better slide effect when sidebar switch between show and hide. Default: undefined
positionStringSet the sidebar position, like fixed, absolute or relative. Default: relative
closeFunctionThis it's usefull to ensure that sidebar is going to be closed after an item it's clicked. Default: () => {}
itemsArrayAn array of object which is going to be rendered on sidebar. Default: []
colorStringHere you can set the color of the items on the Sidebar. Default: undefined

Footer

The Footer component has the necessary to make your site comfortable to your users.

import { Footer } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <>
      <Footer
        brand={{
          short: 'Simply Development',
          long: 'Simply Development',
          withCopyright: true,
          withYear: true
        }}
        background="black"
        color={{
          title: 'white',
          item: 'white'
        }}
        social={{
          facebook: 'https://www.facebook.com/simplydevelopmnt',
          instagram: 'https://www.instagram.com/simplydevelopmnt/',
          twitter: 'https://twitter.com/SimplyDvelopmnt',
          linkedin: 'https://www.linkedin.com/company/simply-development',
          github: 'https://github.com/Simply-Development'
        }}
        items={[
          {
            label: 'Privacy',
            href: '/privacy'
          },
          {
            label: 'Terms of use',
            href: '/terms-of-use'
          }
        ]}
      />
    </>
  )
}

Properties

NameTypeDescription
brandString, function or objectYou can pass a simple String, or be more explicit passing and object with copyright and year to look more profesional, you can also can have total control passing a custom component as a function
backgroundStringHere you can set the footer background. Default: undefined
colorString or objectSet the color of the footer elements, you can als set a color for brand and for other elements. Default: undefined
itemsArraySet the footer elements, like privacy page, terms and conditions and stuffs like that. Default: []
socialobjectSet your social networks. Default: undefined

Banner

The Banner component it's useful to start a page, write your pitch and show your brand to your users.

import { Banner } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <>
      <Banner
        background="black"
        title="Lo que necesitas, cuando lo necesitas"
        color="white"
        message="Encargate de lo que amas, nosotros nos encargamos del desarrollo y la estrategía para ayudarte a crecer"
        button={{
          text: 'Comencemos',
          rounded: true
        }}
      />
    </>
  )
}

Properties

NameTypeDescription
backgroundString or objectSet the background of the banner with a solid color, a linear gradient or an image. Default: undefined
contentPositionString or objectSet the position of the main content, also let you set a position for small devices and for big ones. Default: 'left'
titleStringTitle of the banner, this is were you begin your pitch.
messageStringHere you can complete your pitch. Default: undefined
buttonString or objectCall to action, use this to move your users to another page or execute some action. default: undefined
itemObjectComplete your banner putting some image of your products. Default: undefined

CookieConsent

This component let you show a simple cookie consent for your users to accept it.

import { CookieConsent } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <>
      <CookieConsent
        translucent
        acceptance="Accept"
        accent={() => {}}
      >
        <>
          We use cookies and other technologies to collect data about your browser, device and location. For more information see our Privacy Policy.
        </>
      </CookieConsent>
    </>
  )
}

Properties

NameTypeDescription
backgroundStringBackground of the container. Default: undefined
translucentBooleanIf you want the container to be a little bit translucent. Default: false
childrenReactNodeThe content to display as message, it's a React node instead of a simple String cause of this way you can set by example an a tag inside to move your users to your privacy policy.
colorStringColor of the the acceptance message. Default: undefined
acceptanceString or ObjectThis it's the button in the right side, pass a string or an object with text, color an action to trigger when it's clicked.

SectionWithItem

Display something important, a project, notice or something.

import { SectionWithItem } from 'simply-react-ui-components'

export default function Layout() {
  return (
    <SectionWithItem
      title={() => <img src={`${process.env.PUBLIC_URL}/oaxacarifa.jpg`} className="h-8 mb-5 mx-auto md:mx-0" alt="Oaxacarifa" />}
      pitch="Marca 100% Oaxaqueña en busca de compartir el espiritu oaxaqueño"
      position={{
        small: 'center',
        big: 'left'
      }}
      color={{
        pitch: 'black',
        description: '',
        accent: '#e92f2d'
      }}
      description="Al adquirir productos Oaxacarifa, apoyas a deportistas y artistas urbanos a que sigan con su increíble trabajo."
      action={{
        label: 'Ir al sitio',
        color: 'white',
        rounded: true,
      }}
    />
  )
}

Properties

NameTypeDescription
positionString or ObjectSet position of the main info, also gives you the capability to set a position for small and another for big screens. Default: "left"
titleString or FunctionPass a string or a whole component to display the title of the section. Default: undefined
pitchStringShow the pitch of the section.
descriptionStringBe more explicit about what you want to tell. Default: undefined
colorString or ObjectSet the color or the text of the section or be more specific setting an accent, title and normal color. Default: undefined
actionDisplay a button to trigger and action or move your users to somewhere else, also you can pass an entire component to give them more interectivity. Default: undefined
itemObjectDisplay an item to ilustrate the section, by now image type it's only avaliable. Default: undefined

License

MIT © Simply Development

0.4.53

3 years ago

0.4.52

3 years ago

0.4.51

3 years ago

0.4.42

3 years ago

0.4.41

3 years ago

0.4.31

3 years ago

0.4.32

3 years ago

0.4.35

3 years ago

0.4.33

3 years ago

0.4.34

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.17

3 years ago

0.3.16

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.11

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago