Skip to content

Commit

Permalink
fix(fuselage): MessageSystem time fontScale (#1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored Feb 5, 2024
1 parent dec9be9 commit 8b8d43b
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-brooms-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/fuselage": patch
---

fix(fuselage): MessageSystem time fontScale
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { composeStories } from '@storybook/testing-react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
import React from 'react';

import {
MessageSystem,
MessageSystemLeftContainer,
MessageSystemContainer,
MessageSystemBlock,
MessageSystemName,
MessageSystemBody,
MessageSystemTimestamp,
} from '.';
import * as stories from './MessageSystem.stories';

it('renders without crashing', () => {
render(
<MessageSystem>
<MessageSystemLeftContainer />
<MessageSystemContainer>
<MessageSystemBlock>
<MessageSystemName>Haylie George</MessageSystemName>
<MessageSystemBody>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat a duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam...
</MessageSystemBody>
<MessageSystemTimestamp>12:00 PM</MessageSystemTimestamp>
</MessageSystemBlock>
</MessageSystemContainer>
</MessageSystem>
);
});
const testCases = Object.values(composeStories(stories)).map((Story) => [
Story.storyName || 'Story',
Story,
]);

test.each(testCases)(
`renders %s without crashing`,
async (_storyname, Story) => {
const tree = render(<Story />);
expect(tree.baseElement).toMatchSnapshot();
}
);

test.each(testCases)(
'%s should have no a11y violations',
async (_storyname, Story) => {
const { container } = render(<Story />);

const results = await axe(container);
expect(results).toHaveNoViolations();
}
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ComponentStory } from '@storybook/react';
import React from 'react';

import {
Expand All @@ -24,12 +25,13 @@ export default {
},
};

export const Default = () => (
export const Default: ComponentStory<typeof MessageSystem> = () => (
<Box overflow='hidden'>
<MessageDivider>May, 24, 2020</MessageDivider>
<MessageSystem>
<MessageSystemLeftContainer>
<Avatar
alt=''
url='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC
4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAA
Expand Down Expand Up @@ -65,6 +67,7 @@ export const Default = () => (
<MessageSystem>
<MessageSystemLeftContainer>
<Avatar
alt=''
url='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC
4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAA
Expand Down Expand Up @@ -99,6 +102,7 @@ export const Default = () => (
<MessageSystem>
<MessageSystemLeftContainer>
<Avatar
alt=''
url='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC
4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAA
Expand Down Expand Up @@ -132,6 +136,7 @@ export const Default = () => (
<MessageSystem>
<MessageSystemLeftContainer>
<Avatar
alt=''
url='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC
4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAA
Expand Down Expand Up @@ -167,6 +172,7 @@ export const Default = () => (
<MessageSystem isSelected>
<MessageSystemLeftContainer>
<Avatar
alt=''
url='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC
4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $message-system-background-color-selected: functions.theme(

&__time {
@include typography.use-with-truncated-text();
@include typography.use-font-scale(p2);
@include typography.use-font-scale(c1);
flex-shrink: 0;

margin-inline: lengths.margin(2);
Expand Down
Loading

0 comments on commit 8b8d43b

Please sign in to comment.