Git Product home page Git Product logo

pooltogether-react-components's Introduction

PoolTogether React Tailwind UI Components

React UI components using tailwindcss

Components:

Component Groups

Top level components

Installation:

yarn add @pooltogether/pooltogether-react-components

Usage

Required:

// tailwind.config.js
const pooltogetherTheme = require("@pooltogether/pooltogether-react-components");
module.exports = pooltogetherTheme({
  purge: [],
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
});

Wrap your app in ThemeContextProvider

// _app.jsx
import { ThemeContextProvider } from '@pooltogether/react-components'
import '@pooltogether/react-components/dist/globals.css'

Now you can use any components you want:

import React from "react";
import { Button } from "@pooltogether/pooltogether-react-components";

<Button type="submit">Submit</Button>;

// -------------------

import React from "react";
import Link from "next/link";
import { ButtonLink } from "@pooltogether/pooltogether-react-components";

// External links
<ButtonLink href={href}>View</ButtonLink>
// Internal links
<Link as={'/home'} href={'/home'}><ButtonLink>Home</ButtonLink></Link>

Local development (yalc)

In pooltogether-react-components: yarn yalc publish

In the app you're importing pooltogether-react-components: yalc add @pooltogether/react-components

Local development (yarn)

TODO: Make this better...

In pooltogether-react-components: yarn yarn link

In the app you're importing pooltogether-react-components: yarn link-components

In pooltogether-react-components: yarn link-local yarn start

In the app you're importing pooltogether-react-components: yarn dev

And your app will hot reload when changes are detected in the components folder!

Testing

  • yarn test will run jest

TODO:

  • integrate prettier/husky with our default prettier config
  • copy unit tests over and get them running in this lib

pooltogether-react-components's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pooltogether-react-components's Issues

'Add PTavUSDCe to MetaMask' Providing No Logo

The following button to add the ticket to MetaMask provides a logo for V4 tickets on Ethereum and Polygon:

image

On Avalanche, since the ticket is named PTavUSDCe, and not PTaUSDC, the following line of code does not work:

https://github.com/pooltogether/pooltogether-react-components/blob/main/src/components/Buttons/AddTokenToMetamaskButton.tsx#L44

Apologies for not making a PR myself, but I don't have any repo setup for testing a fix. Either way, the line should probably be changed to something of the likes:

const tokenImageUrl = (token.symbol === 'PTaUSDC' | token.symbol === 'PTavUSDCe') ? TOKEN_IMG_URL.PTaUSDC : undefined

Or it could be refactored entirely to support other token logos in the future, something like:

const tokenImageUrl = TOKEN_IMG_URL[token.symbol] ? TOKEN_IMG_URL[token.symbol] : undefined

The above would mean adding PTavUSDCe: 'https://pooltogether.com/[email protected]' (or any other image) to the following constant:

https://github.com/pooltogether/pooltogether-react-components/blob/main/src/constants.ts#L39

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.