compassIcon.tsx
TLDR
This file exports a functional component called CompassIcon
which renders a compass icon based on the given props.
Class
CompassIcon
This class exports a functional component called CompassIcon
. It takes the following props:
-
icon
(string): The icon to be rendered. It should not contain the "icon-" prefix. -
className
(optional string): Additional class name to be applied to the icon.
The CompassIcon
component renders an <i>
element with the class name "CompassIcon" and the provided icon
prop. If a className
prop is provided, it is appended to the class name.
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react'
type Props = {
icon: string
className?: string
}
export default function CompassIcon(props: Props): JSX.Element {
// All compass icon classes start with icon,
// so not expecting that prefix in props.
return (
<i className={`CompassIcon icon-${props.icon}${props.className === undefined ? '' : ` ${props.className}`}`}/>
)
}