main

mattermost/focalboard

Last updated at: 29/12/2023 09:49

number.tsx

TLDR

This file contains a React component called Number that renders a text editor specifically for handling number properties.

Classes

Number

The Number class is a React component that renders a text editor for handling number properties. It is a functional component that receives PropertyProps as its props. It renders a BaseTextEditor component with some additional validation logic to ensure that the input is a valid number.

Methods

None

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import React from 'react'

import {PropertyProps} from '../types'
import BaseTextEditor from '../baseTextEditor'

const Number = (props: PropertyProps): JSX.Element => {
    return (
        <BaseTextEditor
            {...props}
            validator={() => props.propertyValue === '' || !isNaN(parseInt(props.propertyValue as string, 10))}
        />
    )
}
export default Number