Skip to content

Commit

Permalink
feat(components): migrate Hr to TypeScript (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Jun 18, 2020
1 parent 9591e7f commit d74e55a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/__snapshots__/storyshots.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6477,7 +6477,7 @@ exports[`Storyshots Components/Hr Base 1`] = `
}
<hr
class="circuit-0 circuit-1"
class="circuit-0"
/>
`;

Expand Down
6 changes: 2 additions & 4 deletions src/components/Hr/Hr.docs.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Status, Props, Story } from '../../../.storybook/components';
import Hr from '../../../src/components/Hr/Hr';
import { Hr } from './Hr';

# HR

Expand All @@ -8,13 +8,11 @@ import Hr from '../../../src/components/Hr/Hr';
HR provides a visual line that separates content into sections

<Story id="components-hr--base" />

<Props of={Hr} />

## When to use it

Use it when you need to separate different sections of a certain content within a body text or a list
of data within a card.
Use it when you need to separate different sections of a certain content within a body text or a list of data within a card.

## Usage guidelines

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

import React from 'react';

import Hr from './Hr';
import { create, renderToHtml, axe } from '../../util/test-utils';

import { Hr } from './Hr';

describe('Hr', () => {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import React from 'react';

import docs from './Hr.docs.mdx';
import Hr from './Hr';
import { Hr } from './Hr';

export default {
title: 'Components/Hr',
Expand Down
12 changes: 4 additions & 8 deletions src/components/Hr/Hr.js → src/components/Hr/Hr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
* limitations under the License.
*/

import styled from '@emotion/styled';
import { css } from '@emotion/core';

const baseStyles = ({ theme }) => css`
import styled, { StyleProps } from '../../styles/styled';

const baseStyles = ({ theme }: StyleProps) => css`
label: hr;
display: block;
width: 100%;
Expand All @@ -28,9 +29,4 @@ const baseStyles = ({ theme }) => css`
/**
* A horizontal rule to visually and semantically separate text.
*/
const Hr = styled('hr')(baseStyles);

/**
* @component
*/
export default Hr;
export const Hr = styled('hr')<{}>(baseStyles);
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ exports[`Hr should render with default styles 1`] = `
}
<hr
class="circuit-0 circuit-1"
class="circuit-0"
/>
`;
2 changes: 1 addition & 1 deletion src/components/Hr/index.js → src/components/Hr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
* limitations under the License.
*/

import Hr from './Hr';
import { Hr } from './Hr';

export default Hr;

0 comments on commit d74e55a

Please sign in to comment.