Skip to content

Commit 417ca82

Browse files
committed
feat: migrate blockquote component
1 parent cedeaa0 commit 417ca82

5 files changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`BlockQuote component should render correctly 1`] = `
4+
<div>
5+
<div
6+
class="blockQuote"
7+
/>
8+
</div>
9+
`;
10+
11+
exports[`BlockQuote component should support passing children into the component 1`] = `
12+
<div>
13+
<div
14+
class="blockQuote"
15+
>
16+
This is a block quote
17+
</div>
18+
</div>
19+
`;
20+
21+
exports[`BlockQuote component should support passing multiple children into the component 1`] = `
22+
<div>
23+
<div
24+
class="blockQuote"
25+
>
26+
<p>
27+
This is a block quote
28+
</p>
29+
<p>
30+
This is a block quote
31+
</p>
32+
</div>
33+
</div>
34+
`;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { render } from '@testing-library/react';
2+
import BlockQuote from '../index';
3+
4+
describe('BlockQuote component', () => {
5+
it('should render correctly', () => {
6+
const { container } = render(<BlockQuote />);
7+
8+
expect(container).toMatchSnapshot();
9+
});
10+
11+
it('should support passing children into the component', () => {
12+
const { container } = render(
13+
<BlockQuote>This is a block quote</BlockQuote>
14+
);
15+
16+
expect(container).toMatchSnapshot();
17+
});
18+
19+
it('should support passing multiple children into the component', () => {
20+
const { container } = render(
21+
<BlockQuote>
22+
<p>This is a block quote</p>
23+
<p>This is a block quote</p>
24+
</BlockQuote>
25+
);
26+
27+
expect(container).toMatchSnapshot();
28+
});
29+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.blockQuote {
2+
background-color: var(--color-fill-banner);
3+
border-radius: 5px;
4+
color: var(--color-text-primary);
5+
font-size: var(--font-size-body1);
6+
margin: var(--space-16) auto;
7+
max-width: 90vw;
8+
padding: var(--space-12);
9+
position: relative;
10+
11+
@media (max-width: 900px) {
12+
margin: var(--space-08) auto;
13+
}
14+
15+
p:last-child {
16+
margin: 0;
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import BlockQuote from './index';
2+
3+
export default { component: BlockQuote };
4+
5+
export const Default = {
6+
args: {
7+
children: 'This is a block quote',
8+
},
9+
};
10+
11+
export const MultipleParagraph = {
12+
args: {
13+
children: [
14+
<p key={1}>This is a block quote 1</p>,
15+
<p key={2}>This is a block quote 2</p>,
16+
],
17+
},
18+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { PropsWithChildren } from 'react';
2+
import styles from './index.module.scss';
3+
4+
const BlockQuote = ({ children }: PropsWithChildren) => (
5+
<div className={styles.blockQuote}>{children}</div>
6+
);
7+
8+
export default BlockQuote;

0 commit comments

Comments
 (0)