1.14.0 • Published 8 months ago

@floki-inu/react v1.14.0

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

Getting started

Setup Tailwind CSS

To install Tailwind CSS into your react project, follow the official docs

Install @floki-inu/react

  1. Run the follow command to install @floki-inu/react and other needed dependencies:
yarn add @floki-inu/react react-hook-form
  1. Run the follow command to install @floki-inu/tailwindcss:
yarn add -D @floki-inu/tailwindcss
  1. Add the our tailwindcss plugin to tailwind.config.js, and include content from @floki-inu/react
/** @type {import('tailwindcss').Config} */
export default {
  content: [
    // ...
    './node_modules/@floki-inu/react/dist/**/*.js',
  ],
  plugins: [
    // ...
    require('@floki-inu/tailwindcss'),
  ],
};

Try it out

No you can just import the components you want to use from @floki-inu/react and use them in a .jsx file:

import { Button } from '@floki-inu/react';

export default function MyPage() {
  return (
    <div>
      <Button>Click me</Button>
    </div>
  );
}

Next steps

Dark mode

Note: We only support dark theme for next.js projects

  1. Add theme provider component to the root layout or to an existing providers component:
import { ReactNode } from 'react'
import { ThemeProvider } from '@floki-inu/react/layout'

export default function RootLayouts({ children }: { children: ReactNode }) {
  return (
    <html lang='en'>
      <body>
        <ThemeProvider>{children}</ThemeProvider>
      </body>
    </html>
  )
}
  1. We also provide a theme switch component that you can add to your footer component
import { ThemeSwitch } from '@floki-inu/react/layout'

export function Footer() {
  return (
    <footer>
      <ThemeSwitch />
    </footer>
  )
}
  1. Or you can add next-themes and use the functions provided by the package:
yarn add next-themes

For more details access the package docs

Toasts

  1. To use toasts you need to install sonner package first:
yarn add sonner
  1. Add the Toaster component from @floki-inu/react to your root layout or providers components:
import { ReactNode } from 'react'
import { Toaster } from '@floki-inu/react'

export default function RootLayouts({ children }: { children: ReactNode }) {
  return (
    <html lang='en'>
      <body>
        {children}
        <Toaster />
      </body>
    </html>
  )
}
  1. Now you can fire your toast with the toast() function from sonner package:
import { toast } from 'sonner'
import { Button } from '@floki-inu/react'

export function MyComponent() {
  return (
    <Button onClick={() => toast('An awesome toast!')}>Show a toast</Button>
  )
}