main

mattermost/focalboard

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

email.tsx

TLDR

This file exports a React component called Email, which is used to render an email input field. It imports the PropertyProps interface from ../types and the BaseTextEditor component from ../baseTextEditor.

Classes

There are no classes in this file.

Methods

There are no methods in this file.

// 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 Email = (props: PropertyProps): JSX.Element => {
    return (
        <BaseTextEditor
            {...props}
            validator={() => {
                const emailRegexp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
                return emailRegexp.test(props.propertyValue as string)
            }}
        />
    )
}
export default Email