Skip to content

Commit

Permalink
Create a paragraph component
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyJames committed Jul 6, 2021
1 parent 99bc5d0 commit c883fda
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/components/paragraph/Paragraph.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Text } from "rebass/styled-components";

function Paragraph ({ children, ...props }) {
return (
<Text {...props} as="p" color="text" fontFamily="body" fontSize={[1,2,3]}>
{children}
</Text>
);
}

export default Paragraph;
14 changes: 14 additions & 0 deletions app/src/components/paragraph/Paragraph.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import Paragraph from "components/paragraph";

export default {
title: 'Components/Paragraph',
component: Paragraph,
};

const ParagraphTemplate = (props) => <Paragraph {...props} />

export const ParagraphStory = ParagraphTemplate.bind({});
ParagraphStory.args = {
children: "Lorem ipsum de lorum col a suld icus a puentus aleetum",
};
9 changes: 9 additions & 0 deletions app/src/components/paragraph/Paragraph.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Paragraph from "./index";
import { render } from "@testing-library/react";

describe("Paragraph", () => {
test("render contents", () => {
const { queryByText } = render(<Paragraph>Hello world</Paragraph>);
expect(queryByText("Hello world")).toBeInTheDocument();
})
})
2 changes: 2 additions & 0 deletions app/src/components/paragraph/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Paragraph from "./Paragraph";
export default Paragraph;

0 comments on commit c883fda

Please sign in to comment.