Skip to content

Commit

Permalink
chore: add announcement and topic classNames (#34140)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored Dec 9, 2024
1 parent d569f26 commit c2cf2d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type AnnouncementComponenttParams = {
};

const AnnouncementComponent: FC<AnnouncementComponenttParams> = ({ children, onClickOpen }) => (
<RoomBanner className='rcx-header-section' onClick={onClickOpen}>
<RoomBanner className='rcx-header-section rcx-announcement-section' onClick={onClickOpen}>
<RoomBannerContent data-qa='AnnouncementAnnoucementComponent'>{children}</RoomBannerContent>
</RoomBanner>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/room/body/RoomTopic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const RoomTopic = ({ room, user }: RoomTopicProps) => {
if (!topic && !roomLeader) return null;

return (
<RoomBanner className='rcx-header-section' role='note'>
<RoomBanner className='rcx-header-section rcx-topic-section' role='note'>
<RoomBannerContent>
{roomLeader && !topic && canEdit ? (
<Box is='a' href={href}>
Expand Down
7 changes: 5 additions & 2 deletions packages/ui-client/src/components/RoomBanner/RoomBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const clickable = css`
}
`;

const style = css`
background-color: ${Palette.surface['surface-room']};
`;

export const RoomBanner = ({ onClick, className, ...props }: ComponentProps<typeof Box>) => {
const { isMobile } = useLayout();

Expand All @@ -25,8 +29,7 @@ export const RoomBanner = ({ onClick, className, ...props }: ComponentProps<type
alignItems='center'
overflow='hidden'
flexDirection='row'
bg='room'
className={[onClick && clickable, ...(Array.isArray(className) ? className : [className])]}
className={[style, onClick && clickable, ...(Array.isArray(className) ? className : [className])]}
onClick={onClick}
tabIndex={onClick ? 0 : -1}
role={onClick ? 'button' : 'banner'}
Expand Down
14 changes: 12 additions & 2 deletions packages/ui-client/src/components/RoomBanner/RoomBannerContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { Box } from '@rocket.chat/fuselage';
import { css } from '@rocket.chat/css-in-js';
import { Box, Palette } from '@rocket.chat/fuselage';
import { HTMLAttributes } from 'react';

export const RoomBannerContent = (props: Omit<HTMLAttributes<HTMLElement>, 'is'>) => (
<Box color='hint' fontScale='p2' p={4} flexGrow={1} withTruncatedText {...props} />
<Box
fontScale='p2'
p={4}
flexGrow={1}
withTruncatedText
className={css`
color: ${Palette.text['font-hint']};
`}
{...props}
/>
);

0 comments on commit c2cf2d7

Please sign in to comment.