main

mattermost/focalboard

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

dividerElement.tsx

TLDR

This file is a React component for a divider element. It exports a default React.memo component named "DividerElement" that renders a <div> element with the class name "DividerElement". The component is registered in the contentRegistry to be used as a content type.

Classes

DividerElement

This class is a functional React component that renders a <div> element with the class name "DividerElement". It is exported as the default component for this file.

END

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

import {DividerBlock, createDividerBlock} from '../../blocks/dividerBlock'
import DividerIcon from '../../widgets/icons/divider'

import {contentRegistry} from './contentRegistry'
import './dividerElement.scss'

const DividerElement = (): JSX.Element => <div className='DividerElement'/>

contentRegistry.registerContentType({
    type: 'divider',
    getDisplayText: (intl) => intl.formatMessage({id: 'ContentBlock.divider', defaultMessage: 'divider'}),
    getIcon: () => <DividerIcon/>,
    createBlock: async (): Promise<DividerBlock> => {
        return createDividerBlock()
    },
    createComponent: () => <DividerElement/>,
})

export default React.memo(DividerElement)