Git Product home page Git Product logo

rothko-ui's Introduction

rothko-ui

Rothko-UI

Welcome to Rothko-UI, a comprehensive UI component library designed with flexibility and ease of use in mind. This monorepo contains various packages, with @rothko-ui/ui and @rothko-ui/icons being the primary ones for external use.

Key Packages

  • @rothko-ui/ui: The main package containing all the UI components.
  • @rothko-ui/icons: A collection of SVG icons optimized for Rothko-UI.

Using Rothko-UI

Setup with RothkoProvider

Before using any Rothko-UI components, it's essential to wrap your application or component tree with the RothkoProvider. This context provider ensures that all components function correctly and inherit the necessary themes and configurations.

import { RothkoProvider } from '@rothko-ui/ui';

function MyApp() {
  return <RothkoProvider>{/* Your application components here */}</RothkoProvider>;
}

Basic Component Usage

After setting up the RothkoProvider, you can import and use the components:

import { Button } from '@rothko-ui/ui';

function MyComponent() {
  return <Button>Click Me</Button>;
}

Using Icons

The @rothko-ui/icons package provides a range of SVG icons:

import { HeartIcon } from '@rothko-ui/icons';

function MyComponent() {
  return <HeartIcon />;
}

Installation

To get started with Rothko-UI:

npm install @rothko-ui/ui @rothko-ui/icons

or

yarn add @rothko-ui/ui @rothko-ui/icons

Server-Side Rendering (SSR) with Rothko UI

Rothko UI utilizes styled-components for styling its components. If you're integrating Rothko UI into a server-side rendered (SSR) application, it's essential to ensure that the style sheets are correctly generated and sent to the client. This prevents flash-of-unstyled-content (FOUC) issues and ensures a smooth user experience.

For Next.js Applications:

Next.js is a popular React framework that supports SSR out of the box. If you're using Rothko UI with Next.js, special considerations need to be made for styled-components.

To correctly handle styled-components with SSR in Next.js:

  1. Install Required Dependencies: Ensure you have both styled-components and its Babel plugin installed:

    yarn add styled-components babel-plugin-styled-components
  2. Configure Babel: Update your .babelrc (or babel.config.json) to include the styled-components plugin:

    {
      "presets": ["next/babel"],
      "plugins": [["styled-components", { "ssr": true }]]
    }
  3. Use ServerStyleSheet: In your custom _document.js (or _document.tsx), use ServerStyleSheet from styled-components to collect and inline the styles:

    import Document from 'next/document';
    import { ServerStyleSheet } from 'styled-components';
    
    export default class MyDocument extends Document {
      static async getInitialProps(ctx) {
        const sheet = new ServerStyleSheet();
        const originalRenderPage = ctx.renderPage;
    
        try {
          ctx.renderPage = () =>
            originalRenderPage({
              enhanceApp: App => props => sheet.collectStyles(<App {...props} />),
            });
    
          const initialProps = await Document.getInitialProps(ctx);
          return {
            ...initialProps,
            styles: (
              <>
                {initialProps.styles}
                {sheet.getStyleElement()}
              </>
            ),
          };
        } finally {
          sheet.seal();
        }
      }
    }

By following these steps, styled-components will correctly generate and inline styles during server-side rendering, ensuring that your Rothko UI components are styled appropriately when your Next.js application is loaded.

Author

@luxo-ai [email protected]

Support the project: 0x7A67fF6354d983B6cfc3a7f7C5BA93f73C864b32

License

MIT

rothko-ui's People

Contributors

luxo-ai avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

luserazo-burner

rothko-ui's Issues

Testing bug issues

Describe the bug

Provide a clear description of the bug.

Steps to Reproduce

Introduce steps to reproduce:

1. Go to '...'
2. Click/select/etc on '...'
3. See error

Expected behavior

Provide a clear and concise description of what you expected to happen.

Device meta

Provide some details about the system you're running.

Screenshots/Videos (optional)

Optionally provide some media to help explain the bug.

Other (optional)

Add optional info here.

Simplify words.ts

Proposed improvement

Use this regex /[\p{L}\p{N}'-]+|\p{Sc}\p{N}+|\p{P}|\s+/gu

Testing feature request

Describe the feature ๐Ÿ’…

Provide a clear and concise description of the feature.

Proposed solution

Offer a clear and concise description of the proposed solution.

Design images (optional)

Optionally provide some design images.

Additional info (optional)

Provide any supplemental information here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.