Skip to content

Commit

Permalink
H3 (#60)
Browse files Browse the repository at this point in the history
* add an h3 heading

* bump version

* use updated color
  • Loading branch information
jivey authored Nov 18, 2024
1 parent 31d499d commit afd0262
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openstax/ui-components",
"version": "1.10.7",
"version": "1.10.8",
"license": "MIT",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
Expand Down
12 changes: 10 additions & 2 deletions src/components/Text.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Paragraph, H2 } from './Text';
import { Paragraph, H2, H3 } from './Text';
import renderer from 'react-test-renderer';

describe('Text', () => {
Expand All @@ -9,10 +9,18 @@ describe('Text', () => {
expect(tree).toMatchSnapshot();
});

it('matches heading snapshot', () => {
it('matches h2 snapshot', () => {
const tree = renderer.create(
<H2>This is a heading</H2>
).toJSON();
expect(tree).toMatchSnapshot();
});

it('matches h3 snapshot', () => {
const tree = renderer.create(
<H3>This is a heading</H3>
).toJSON();
expect(tree).toMatchSnapshot();
});

});
19 changes: 12 additions & 7 deletions src/components/Text.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { H2, Paragraph } from "./Text";
import { H2, H3, Paragraph } from "./Text";

export const PText = () => <>
<Paragraph>Body text</Paragraph>
</>;
export const PText = () => (
<>
<Paragraph>Body text</Paragraph>
</>
);

export const Heading = () => <>
<H2>Heading text</H2>
</>;
export const Heading = () => (
<>
<H2>H2 Heading text</H2>
<H3>H3 Heading text</H3>
</>
);
7 changes: 7 additions & 0 deletions src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export const H2 = styled.h2`
font-weight: 700;
`;

export const H3 = styled.h3`
color: ${palette.neutralDarker};
font-size: 1.4rem;
font-weight: 700;
text-transform: uppercase;
`;

export const Paragraph = styled.p`
color: ${palette.neutralDarker};
font-size: 1.8rem;
Expand Down
12 changes: 10 additions & 2 deletions src/components/__snapshots__/Text.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

exports[`Text matches body snapshot 1`] = `
<p
className="sc-gsnTZi eGRQDn"
className="sc-dkzDqf fZIluk"
>
This is a paragraph
</p>
`;

exports[`Text matches heading snapshot 1`] = `
exports[`Text matches h2 snapshot 1`] = `
<h2
className="sc-bczRLJ fZeHof"
>
This is a heading
</h2>
`;

exports[`Text matches h3 snapshot 1`] = `
<h3
className="sc-gsnTZi kMMRnk"
>
This is a heading
</h3>
`;

0 comments on commit afd0262

Please sign in to comment.