Sentre Legacy
  • 🥳Welcome
  • Getting Started
  • DApp Manifest
  • Folder Structure
  • Available Scripts
  • Development
    • View
    • Model & Controllers
    • Providers
      • UI Provider
      • Wallet Provider
      • Account Provider
      • Mint Provider
    • Static
    • Global variables
    • Configs
  • Advanced Usage
    • ☀️Theme
    • 👘Customizing Styles
    • 🪝Hooks
  • 🤩Submitting DApps
  • References
  • Best Practices
  • Troubleshoots
  • 🎨Design Pricinples
    • Button
    • Card
    • Checkbox
    • Color
    • Corner radius
    • Drawer
    • Dropdown
    • Grid
    • Icons
    • Input
    • List
    • Menu
    • Modal
    • Radio
    • Select
    • Shadow
    • Spacing
    • Switch
    • Tabs
    • Tooltip
    • Table
    • Typography
  • 📄Litepaper
    • Introduction
    • Industry Problems
    • Sentre: An All-in-one Solution
      • The Open Protocol
      • Liquidity Efficiency
    • SEN as the Heart of the Ecosystem
      • Asymmetric Deposit
      • Adaptive Fee Model
      • The Triad Pool
      • Simulated Mesh Trading
      • Token Use Cases
    • Conclusion
Powered by GitBook
On this page
  • API
  • Context
  • Hook & HOC
  1. Development
  2. Providers

UI Provider

🌈 User Interface Provider

UIProvider is strictly required if the DApp uses default UI system of the platform, or a customized design system based on Ant Design.

API

<UIProvider> ... </UIProvider>
Property
Type
Description
Default

children

ReactNode

The wrapped children.

undefined

appId

string

DApp's id.

style

?CSSPreperties

The additional style for span tags.

{}

antd

? (boolean | FC<ConfigProviderProps>)

false

For example

import { UIProvider } from '@sentre/senhub'

// Wrap a paragraph as a child and style it to red color.
<UIProvider appId="my_app" style={{color: 'red'}}>
  <p>Hello world</p>
</UIProvider>

Context

type Provider = {
  ui: State
}

type State = {
  theme: 'light' | 'dark'
  width: number
  infix: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
  touchable: boolean
  visibleActionCenter: boolean
}

Provider

Property
Type
Description

ui

State

The user interface data.

State

Property
Type
Description

theme

light | dark

Current theme mode.

width

number

Current width of screen.

infix

xs | sm | md | lg | xl | xxl

Current breakpoint of screen.

touchable

boolean

Whether or not touch screen.

visibleActionCenter

boolean

Whether or not visible action center.

Hook & HOC

import { useUI, withUI } from '@senhub/providers'

For example

Wrap the parent by UIProvider before accessing the context.

import { useUI, withUI } from '@senhub/providers'

// Within a functional component
const Component = () => {
  const {
    ui: { width, infix },
  } = useUI()
}
export default Component

// Within a class component
class Component {
  render() {
    const {
      ui: { width, infix },
    } = this.props
  }
}
export default withUI(Component)
PreviousProvidersNextWallet Provider

Last updated 2 years ago

Enable isolated antd. You can input the ConfigProvider as .

Ant Design ConfigProvider API