Skip to content

Commit 9dcd759

Browse files
Filipe Marinstassoevan
Filipe Marins
andauthored
feat(fuselage): Add message status indicator text component (#757)
* fix: message status private indicator props * feat: add status indicator text * style: add space on example * Remove resting props * Make status indicator text unselectable * Ensure status indicator is ARIA-hidden for now Co-authored-by: Tasso Evangelista <tasso.evangelista@rocket.chat>
1 parent 57f3e93 commit 9dcd759

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

packages/fuselage/src/components/Message/MessageStatusIndicator/MessageStatusIndicator.stories.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Box, Avatar } from '../..';
66
import { MessageDivider } from '../MessageDivider';
77
import MessageReactions from '../MessageReactions';
88
import MessageToolbox from '../MessageToolbox';
9+
import { MessageStatusIndicatorText } from './MessageStatusIndicatorText';
910

1011
export default {
1112
title: 'Message/MessageStatusIndicator',
@@ -103,5 +104,26 @@ export const Default = () => (
103104
</MessageToolbox>
104105
</MessageToolbox.Wrapper>
105106
</Message>
107+
<Message className='customclass' clickable sequential>
108+
<Message.LeftContainer>
109+
<MessageStatusIndicator>
110+
<MessageStatusIndicatorText>
111+
<MessageStatusIndicatorItem name='star-filled' /> Status
112+
</MessageStatusIndicatorText>
113+
</MessageStatusIndicator>
114+
</Message.LeftContainer>
115+
<Message.Container>
116+
<Message.Body>
117+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
118+
</Message.Body>
119+
</Message.Container>
120+
<MessageToolbox.Wrapper>
121+
<MessageToolbox>
122+
<MessageToolbox.Item icon='quote' />
123+
<MessageToolbox.Item icon='clock' />
124+
<MessageToolbox.Item icon='thread' />
125+
</MessageToolbox>
126+
</MessageToolbox.Wrapper>
127+
</Message>
106128
</Box>
107129
);

packages/fuselage/src/components/Message/MessageStatusIndicator/MessageStatusIndicator.styles.scss

+11
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,21 @@ $variants: (
1111
);
1212

1313
.rcx-message-status-indicator {
14+
margin-block: lengths.margin(2);
15+
16+
user-select: none;
17+
1418
&:empty {
1519
display: none;
1620
}
1721

22+
&__text {
23+
white-space: nowrap;
24+
25+
color: colors.foreground('info');
26+
@include typography.use-font-scale(c1);
27+
}
28+
1829
&__item {
1930
color: colors.foreground('hint');
2031
@each $name, $color in $variants {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { ReactNode } from 'react';
2+
import React from 'react';
3+
4+
type MessageStatusIndicatorTextProps = {
5+
children: ReactNode;
6+
};
7+
8+
export const MessageStatusIndicatorText = ({
9+
children,
10+
}: MessageStatusIndicatorTextProps) => (
11+
<span className='rcx-message-status-indicator__text' aria-hidden>
12+
{children}
13+
</span>
14+
);

packages/fuselage/src/components/Message/MessageStatusIndicator/MessageStatusPrivateIndicator.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import React from 'react';
33

44
import type { MessageStatusIndicatorItem } from './MessageStatusIndicatorItem';
55

6-
type MessageStatusIndicatorItemProps = ComponentProps<
7-
typeof MessageStatusIndicatorItem
6+
type MessageStatusIndicatorItemProps = Pick<
7+
ComponentProps<typeof MessageStatusIndicatorItem>,
8+
'variant'
89
>;
910

1011
export const MessageStatusPrivateIndicator = ({

0 commit comments

Comments
 (0)