-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fuselage): create
LabelInfo
component (#1214)
- Loading branch information
1 parent
51e16ef
commit 68674c5
Showing
10 changed files
with
298 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/fuselage": minor | ||
--- | ||
|
||
feat(fuselage): create `LabelInfo` component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import WithErrorWrapper from '../../helpers/WithErrorWrapper'; | ||
import { LabelInfo } from '../Label/LabelInfo'; | ||
import { FieldContext } from './Field'; | ||
|
||
type FieldLabelInfoProps = ComponentProps<typeof LabelInfo>; | ||
|
||
export const FieldLabelInfo = (props: FieldLabelInfoProps) => { | ||
const component = <LabelInfo {...props} />; | ||
|
||
if (process.env.NODE_ENV === 'development') { | ||
return ( | ||
<WithErrorWrapper | ||
context={FieldContext} | ||
parentComponent='Field' | ||
componentName={FieldLabelInfo.name} | ||
> | ||
{component} | ||
</WithErrorWrapper> | ||
); | ||
} | ||
|
||
return component; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import Box from '../Box/Box'; | ||
import { Icon } from '../Icon'; | ||
|
||
type LabelInfoProps = { | ||
title: string; | ||
id?: string; | ||
} & Omit<ComponentProps<typeof Icon>, 'name'>; | ||
|
||
export const LabelInfo = ({ title, id, ...props }: LabelInfoProps) => ( | ||
<Box is='span' mi={2} rcx-label__info> | ||
<span hidden id={id}> | ||
{title} | ||
</span> | ||
<Icon {...props} name='info-circled' title={title} /> | ||
</Box> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters