0.43.0 • Published 14 days ago

@lidofinance/ui-primitives v0.43.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@lidofinance/ui-primitives

Widget UI primitives: components, hooks.

This component abstracted from the blockchain network, other words you can use it for any widgets for any blockchains.

Installation

  • React 17 || 18
yarn add @lidofinance/ui-primitives

# and additional
yarn add next@^12.3.0 styled-components@^5.3.5 @lidofinance/lido-ui@^3.6.1

Using

Wallet components

You can make wallet components (like in image below) via @lidofinance/ui-primitives package.

Example based on Eth:

The design you can find on Figma https://www.figma.com/file/pmtFrBp0z1RvzdfcHaV2fn/Widget-UI-Guide?node-id=2-3256&t=VZj5YPwLffneQwE1-0

// `useWeb3` and other imports what is out of context here
import {
  WalletCard,
  WalletCardRow,
  WalletCardBalance,
  WalletCardAccount,
  WalletFallback,
} from '@lidofinance/ui-primitives'
import { Divider } from '@lidofinance/lido-ui'

const EthWalletCard: EthWalletCardComponent = (props) => {
  // `account`, `openModal` and other what is out of context here

  return (
    <WalletCard {...props}>
      <WalletCardRow>
        <WalletCardBalance
          title="Eth balance"
          loading={false}
          value={'100.00 ETH'}
          extra={'Extra content here'}
        >Children content here</WalletCardBalance>
        <WalletCardAccount account={account} onClickCb={openModal} />
      </WalletCardRow>
      <Divider />
      <WalletCardRow>
        <WalletCardBalance
          small
          title="Token balance"
          loading={false}
          value={'1000.00 stETH'}
          extra={'Extra content here'}
        >Children content here</WalletCardBalance>
        <WalletCardBalance
          small
          title="Token balance"
          loading={false}
          value={'1000.00 wstETH'}
          extra={'Extra content here'}
        >Children content here</WalletCardBalance>
      </WalletCardRow>
    </WalletCard>
  )
}

const EthWalletCardWrapper: EthWalletCardComponent = (props) => {
  const { active } = useWeb3()
  return active ? <EthWalletCard {...props} /> : <WalletFallback {...props} />
}

export default EthWalletCardWrapper
0.43.0

14 days ago

0.42.0

2 months ago

0.41.0

2 months ago

0.40.0

3 months ago

0.39.1

5 months ago

0.32.0

10 months ago

0.31.0

10 months ago

0.30.0

10 months ago

0.29.0

10 months ago

0.39.0

7 months ago

0.38.0

8 months ago

0.37.1

8 months ago

0.37.0

8 months ago

0.36.0

9 months ago

0.35.0

9 months ago

0.34.0

9 months ago

0.33.0

10 months ago

0.28.0

11 months ago

0.27.0

11 months ago

0.26.0

11 months ago

0.25.0

12 months ago

0.24.0

12 months ago

0.23.0

12 months ago