/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/common-adapters/empty-state.tsx
67 строк
2 KB
chrisnojima
refactor(styles): theme via hooks, no android remount (#29515)
08 авг 2026, 02:24
Не верифицирован
08 авг 2026, 02:24
a41d38e
Код
Авторство
О чём код?
import type * as React from 'react' import * as Styles from '@/styles' import {Box2} from './box' import Button from './button' import Icon from './icon' import IconAuto from './icon-auto' import Text from './text' import type {IconType} from './icon.constants-gen' export type EmptyStateProps = { action?: { label: string mode?: 'Primary' | 'Secondary' onClick: () => void } centerChildren?: boolean children?: React.ReactNode gap?: keyof typeof Styles.globalMargins // fancy illustration image; wins over icon if both are passed illustration?: IconType icon?: IconType style?: Styles.StylesCrossPlatform text?: string textType?: 'Body' | 'BodySmall' title?: string } const EmptyState = (props: EmptyStateProps) => { const theme = Styles.useTheme() const {action, centerChildren = true, children, gap = 'small', icon, illustration} = props const {style, text, textType = 'Body', title} = props return ( <Box2 direction="vertical" centerChildren={centerChildren} fullWidth={true} gap={gap} style={Styles.collapseStyles([Styles.globalStyles.flexGrow, style])} > {illustration ? <IconAuto type={illustration} /> : null} {!illustration && icon ? ( <Icon color={theme.black_20} fontSize={48} type={icon} /> ) : null} {title ? ( <Text center={true} type="Header"> {title} </Text> ) : null} {text ? ( <Text center={true} type={textType}> {text} </Text> ) : null} {children} {action ? ( <Button type="Default" mode={action.mode ?? 'Secondary'} label={action.label} onClick={action.onClick} /> ) : null} </Box2> ) } export default EmptyState