All Projects β†’ devthiago β†’ react-ui-hooks

devthiago / react-ui-hooks

Licence: MIT license
🧩Simple repository of React hooks for building UI components

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to react-ui-hooks

Fre
πŸ‘» Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+15875%)
Mutual labels:  hooks, hook, react-hooks
useAudioPlayer
Custom React hook & context for controlling browser audio
Stars: ✭ 176 (+780%)
Mutual labels:  hooks, hook, react-hooks
React Use Wizard
πŸ§™ A React wizard (stepper) builder without the hassle, powered by hooks.
Stars: ✭ 162 (+710%)
Mutual labels:  hooks, hook
Useworker
βš›οΈ useWorker() - A React Hook for Blocking-Free Background Tasks
Stars: ✭ 2,233 (+11065%)
Mutual labels:  hooks, hook
React Form
βš›οΈ Hooks for managing form state and validation in React
Stars: ✭ 2,270 (+11250%)
Mutual labels:  hooks, react-hooks
React Intersection Observer
React implementation of the Intersection Observer API to tell you when an element enters or leaves the viewport.
Stars: ✭ 2,689 (+13345%)
Mutual labels:  hooks, hook
Haunted
React's Hooks API implemented for web components πŸ‘»
Stars: ✭ 2,197 (+10885%)
Mutual labels:  hooks, react-hooks
React Nprogress
βŒ›οΈ A React primitive for building slim progress bars.
Stars: ✭ 173 (+765%)
Mutual labels:  hooks, hook
use-route-as-state
Use React Router route and query string as component state
Stars: ✭ 37 (+85%)
Mutual labels:  hook, react-hooks
react-use-countdown
React hook for countdown state.
Stars: ✭ 19 (-5%)
Mutual labels:  hook, react-hooks
web
React hooks done right, for browser and SSR.
Stars: ✭ 940 (+4600%)
Mutual labels:  hook, react-hooks
React Universal Hooks
πŸŽ‰ React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!
Stars: ✭ 148 (+640%)
Mutual labels:  hooks, hook
Hooks
Async middleware for JavaScript and TypeScript
Stars: ✭ 117 (+485%)
Mutual labels:  hooks, hook
Pinst
🍺 dev only postinstall hooks (package.json)
Stars: ✭ 162 (+710%)
Mutual labels:  hooks, hook
Graphql Hooks
🎣 Minimal hooks-first GraphQL client
Stars: ✭ 1,610 (+7950%)
Mutual labels:  hooks, react-hooks
Swifthook
A library to hook methods in Swift and Objective-C.
Stars: ✭ 93 (+365%)
Mutual labels:  hooks, hook
react-hook-videojs
Easy React integration of Video.js using hooks.
Stars: ✭ 37 (+85%)
Mutual labels:  hook, react-hooks
Ysf
YSF Server Functions
Stars: ✭ 77 (+285%)
Mutual labels:  hooks, hook
React Selector Hooks
Collection of hook-based memoized selector factories for declarations outside of render.
Stars: ✭ 84 (+320%)
Mutual labels:  hooks, hook
Pywinauto
Windows GUI Automation with Python (based on text properties)
Stars: ✭ 3,175 (+15775%)
Mutual labels:  hooks, user-interface

React UI Hooks

All Contributors Build Status Coverage Status

Simple repository of React hooks for building UI components

The Problem

Before we have React Hooks we had to separate components into logic and view ones, if we would like to share IU logic like a component for tabs. Another way to do that is using components built over CSS frameworks like Bootstrap or Materialize, but we have to change a bunch of style if we want to create our own style. What it means is that style should be unique, your product/application should have an unique design. However, the logic for creating UI components is basically the same.

This Solution

The react-ui-hooks is a repository of React Hooks for UI logic. The main idea on this approach is to share and collaborate hooks to became building UI components easier and to try not "reinventing the wheel" one more time (although be doing this 🧐). As well as writing less of the same logic as always, this project also aims to help teams write less CSS, since we can avoid too much use of unnecessary CSS that comes with components/UI third part libraries.

Example

import React from 'react'
import { useSlider } from 'react-ui-hooks'
import './style.scss'

const setSlideClassname = (isActive, type = 'slide') => {
  const className = `carousel__${type}`
  if (isActive) {
    return `${className} ${className}--active`
  }
  return className
}

const createSlides = activeSlide => (slide, index) => (
  <li
    className={setSlideClassname(index === activeSlide)}
    key={`slide-item-${index}`}
    children={slide}
  />
)

const createSlideIndicators = (activeSlide, goToSlide = () => null) => (
  (slide, index) => (
    <li key={`slide-indicator-${index}`}>
      <a
        href='!#'
        className={setSlideClassname(index === activeSlide, 'indicator')}
        onClick={() => goToSlide(index)}
      />
    </li>
  )
)

const Carousel = ({ children, ...config }) => {
  const {
    activeSlide,
    nextSlide,
    prevSlide,
    goToSlide,
    goToNextSlide,
    goToPrevSlide
  } = useSlider(children.length, config)

  return (
    <div className='carousel-container'>
      <div className='carousel'>
        <a
          href='!#'
          className='carousel__arrow carousel__arrow--left'
          onClick={goToPrevSlide}
          children={'<'}
        />

        <ul
          className='carousel__slides'
          children={children.map(createSlides(activeSlide))}
        />

        <a
          href='!#'
          className='carousel__arrow carousel__arrow--right'
          onClick={goToNextSlide}
          children={'>'}
        />

        <ul className='carousel__indicators'>
          {children.map(createSlideIndicators(activeSlide, goToSlide))}
        </ul>
      </div>
    </div>
  )
}

export default Carousel

Contributing

Contributors

Thanks goes to these wonderful people (emoji key):

Thiago Alves Luiz
Thiago Alves Luiz

πŸš‡ πŸ’»
JoΓ£o Pedro Raskopf
JoΓ£o Pedro Raskopf

πŸš‡ πŸ’»
Tauan Tathiell
Tauan Tathiell

πŸ“–
Elaine Mattos
Elaine Mattos

πŸ“–
Gustavo FΓ£o Valvassori
Gustavo FΓ£o Valvassori

πŸš‡
Guto Foletto
Guto Foletto

πŸ‘€
Felipe Lovato Flores
Felipe Lovato Flores

πŸ‘€

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].