main

mattermost/focalboard

Last updated at: 28/12/2023 01:34

number.tsx

TLDR

This file contains a React component called "Number" which is a text editor for handling number properties. It is a child component of the "BaseTextEditor" component and includes validation to ensure that the entered value is a valid number.

Methods (if applicable)

N/A

Classes (if applicable)

N/A

// 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