0.8.10 • Published 5 months ago

@playbooks/ui v0.8.10

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Overview

An interface library for Playbooks

Prerequisites

  • Font Awesome
  • React
  • Next
  • Tailwind

Installation

npm install @playbooks/ui

Usage

Wrap your application with the and make sure to pass in the @playbooks/theme or a separate theme of your choosing.

# _app.tsx

import { AppProps } from 'next/app';
import * as theme from '@playbooks/theme';
import '@playbooks/ui/styles.css';
import { InterfaceProvider } from '@playbooks/ui/context';

const App = ({ Component, pageProps }: AppProps) => {

	// Render
	return (
		<InterfaceProvider meta={meta} theme={theme}>
      <Component ssr={pageProps} {...contexts} />
		</InterfaceProvider>
	);
};

export default App;

Then, import the components you want to use and compose from there.

import { Accordion, AccordionBody, AccordionText, AccordionTitle, AccordionToggle } from '@playbooks/ui/accordions';
import { Span } from '@playbooks/ui/html';
import { FarIcon } from '@playbooks/ui/icons';

const FaqAccordion = ({ title, text }) => {
  const [open, setOpen] = useState(false);

  // Methods
  const onToggle = () => setOpen(!open);

  // Render
  return (
    <Accordion open={open} border='border' borderRadius='rounded-md' spacing='mb-4'>
      <AccordionToggle size='' open={open} onClick={onToggle} borderRadius='' spacing='p-6'>
        <Span display='flex-start' space='space-x-4'>
          <FarIcon icon='circle-question' fontSize='text-lg' />
          <AccordionTitle fontSize='text-base'>{title}</AccordionTitle>
        </Span>
      </AccordionToggle>

      <AccordionBody open={open} spacing='px-4 py-6' animate>
        <AccordionText>{text}</AccordionText>
      </AccordionBody>
    </Accordion>
  )
}

export { FaqAccordion }

Development

This project is designed for development using the yalc library.

  • npm run dev
  • switch to project
  • npx yalc add @playbooks/theme
  • You may need to restart your application server
  • After that, this library will hot reload into the consuming application

Scripts

We've included a couple of helpful scripts for faster development.

  • npm run deploy -- 'commit message'
  • npm run publish -- 'commit message' [major|minor|patch]

Husky

  • Husky configuration is setup to lint and format the repo on every commit
  • Edit the .husky/pre-commit file to change your settings

Author

Notes

To see this library in action, checkout the following projects:

0.8.10

5 months ago

0.8.9

5 months ago

0.8.8

5 months ago

0.8.7

5 months ago

0.8.6

5 months ago

0.8.4

5 months ago

0.8.3

5 months ago

0.8.1

5 months ago

0.8.0

5 months ago

0.7.10

5 months ago

0.7.9

5 months ago

0.7.7

5 months ago

0.7.5

5 months ago

0.7.4

5 months ago

0.7.3

5 months ago

0.7.2

5 months ago

0.7.1

5 months ago

0.7.0

5 months ago

0.6.0

5 months ago

0.5.0

6 months ago

0.4.6

6 months ago

0.4.5

6 months ago

0.4.4

6 months ago

0.4.3

6 months ago

0.4.2

6 months ago

0.4.0

6 months ago