Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components): migrate Hr to TypeScript #620

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;