From 0cbbe1fda038b278222980fdbe9306a6f0feda62 Mon Sep 17 00:00:00 2001 From: Igor Fedorov Date: Thu, 17 Oct 2019 01:39:46 +0800 Subject: [PATCH] File: add disabled prop --- src/components/Button/Button.tsx | 18 +++++++++++------- src/components/File/File.tsx | 9 +++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 751350eaf3..d5bf2ff5ef 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { FunctionComponent, HTMLAttributes, ReactNode, ComponentType } from 'react'; import getClassName from '../../helpers/getClassName'; import classNames from '../../lib/classNames'; import Tappable from '../Tappable/Tappable'; @@ -6,7 +6,7 @@ import CellButton from '../CellButton/CellButton'; import { HasChildren, HasRootRef } from '../../types/props'; import usePlatform from '../../hooks/usePlatform'; -export interface ButtonProps extends React.HTMLAttributes, HasChildren, HasRootRef { +export interface ButtonProps extends HTMLAttributes, HasChildren, HasRootRef { /** * Значения `1`, `2`, `3`, `sell`, `buy` устарели. Маппинг на новые значения находится в * статическом методе `Button.mapOldLevel(level)`. Старые значения будут удалены в 3.0.0 @@ -20,10 +20,14 @@ export interface ButtonProps extends React.HTMLAttributes, HasChild type?: 'default' | 'cell', align?: 'left' | 'center' | 'right', stretched?: boolean, - before?: React.ReactNode, - after?: React.ReactNode, - component?: string | React.ComponentType, - stopPropagation?: boolean + before?: ReactNode; + after?: ReactNode; + component?: string | ComponentType; + stopPropagation?: boolean; + /** + * @ignore + */ + disabled?: boolean; } const mapOldLevel = level => { @@ -43,7 +47,7 @@ const mapOldLevel = level => { } }; -const Button: React.FunctionComponent = (props: ButtonProps) => { +const Button: FunctionComponent = (props: ButtonProps) => { const platform = usePlatform(); if (props.type === 'cell') { return ; diff --git a/src/components/File/File.tsx b/src/components/File/File.tsx index 9dd35d6e8b..1054c819cd 100644 --- a/src/components/File/File.tsx +++ b/src/components/File/File.tsx @@ -9,11 +9,15 @@ export interface FileProps extends ButtonProps, HasRef { /** * @deprecated Используйте `children`. Свойство `label` будет удалено в 3.0.0 */ - label: ButtonProps['children'] + label: ButtonProps['children']; /** * @deprecated Используйте `align`. Свойство `alignment` будет удалено в 3.0.0 */ - alignment: ButtonProps['align'] + alignment: ButtonProps['align']; + /** + * @ignore + */ + disabled?: boolean; } const File: FunctionComponent = (props: FileProps) => { @@ -34,6 +38,7 @@ const File: FunctionComponent = (props: FileProps) => { before={before} style={style} getRootRef={getRootRef} + disabled={restProps.disabled} > {children || label}