npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stardust-ds/react

v0.8.12

Published

Stardust Design System to ReactJS developed by Ubistart

Downloads

375

Readme

Stardust - React

Seja bem vindo a biblioteca de UI para React desenvolvido pelo time da Ubistart!

Essa biblioteca foi desenvolvida para agilizar o processo de criação de aplicativos em React e extrair o máximo de complexidade do lado do desenvolvedor para que o processo seja mais ágil.

Como utilizar?

Nossa biblioteca precisa de algumas configurações para que o padrão do Design System funcione corretamente.

  • Instalação da lib:

    yarn add @stardust-ds/react
    # ou
    npm add @stardust-ds/react
  • Adicionar tipografia: Usamos uma fonte padrão, então para fazer uso desta, você precisará adicionar a importação da fonte em public/index.html. O tema Stardust aplicará estas fontes automaticamente.

    • Importação:
      <link rel="preconnect" href="https://fonts.googleapis.com" />
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
      <link
        href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
        rel="stylesheet"
      />
  • Configuração do tema: Após, é somente englobar a aplicação com o Provider do tema:

    // App.tsx
    
    import { ThemeProvider } from '@stardust-ds/react';
    import Page from 'path/to/page';
    
    const App = () => {
      return (
        <ThemeProvider>
          <Page />
        </ThemeProvider>
      );
    };

Utilizando os componentes

  import { ThemeProvider, Button } from '@stardust-ds/react';

  const App = () => (
    <ThemeProvider>
      <Button onClick={() => console.log("Stardust button"!)}>
        Stardust
      </Button>
    </ThemeProvider>
  );

Customizando o tema

Nossa biblioteca tem a possibilidade de sobrescrever os estilos definidos por padrão, usados no nosso Design System.

Para isso, utilize a função extendTheme() para inserir as propriedades do seu tema, ou sobrescrever as já existentes, como por exemplo:

import { ThemeProvider, extendTheme } from '@stardust-ds/react';

const theme = {
  color: {
    primary: {
      pure: 'red',
    },
    ubistart: 'blue',
  },
};

const customTheme = extendTheme(theme);

const App = () => (
  <ThemeProvider theme={customTheme}>
    <Page />
  </ThemeProvider>
);

Após essa definição, já estará disponível para utilização a propriedade theme.brand.color.ubistart, assim como a cor principal foi alterada.

Para acessar essa propriedade temos que invocar o nosso custom hook de tema e utilizar a propriedade theme dele.

Adicionando tipagem

Se estiver utilizando Typescript (altamente recomendado), para que seu projeto identifique as propriedades sobrescritas no tema, deve-se criar um arquivo de tipos para sobrescrever a tipagem da biblioteca também.

Para que isso seja possível, você deve:

  • Criar um arquivo de definição do typescript, por exemplo: stardust-ds.d.ts

  • Sobrescrever o tema da seguinte maneira:

  import { customTheme } from './App'; // lembre de exportar essa informação no seu App ou onde quer que tenha definido ela e importe aqui

  type Theme = typeof customTheme;

  declare module '@stardust-ds/react' {
    export interface StardustTheme extends Theme {}
    export function useTheme(): StardustTheme;
  }
  • Caso esteja utilizando o styled components, deve fazer a etapa a seguir para que o DefaultTheme seja sobrescrito:
  ...

  import { StardustTheme } from '@stardust-ds/react'

  ...

  declare module 'styled-components' {
    export interface DefaultTheme extends StardustTheme {}
  }