Skip to content

Commit 457639a

Browse files
committed
Text props
1 parent 9cb4e72 commit 457639a

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components';
22
import css from '@styled-system/css';
3-
import { Text, ITextProps } from '../Text';
3+
import { Text, TextProps } from '../Text';
44

5-
type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & ITextProps & {};
5+
type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & TextProps & {};
66

77
export const Label = styled(Text).attrs({ as: 'label' })<LabelProps>(css({}));
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
import React from 'react';
2-
import styled from 'styled-components';
32
import css from '@styled-system/css';
4-
import { Text, ITextProps } from '../Text';
3+
import { Text, TextProps } from '../Text';
54

65
type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &
76
React.AnchorHTMLAttributes<HTMLSpanElement> &
8-
ITextProps;
9-
10-
const LinkElement = styled(Text).attrs({ as: 'a' })<LinkProps>(
11-
css({
12-
cursor: 'pointer',
13-
textDecoration: 'none',
14-
transition: 'color ease',
15-
transitionDuration: theme => theme.speeds[2],
16-
':hover, :focus': {
17-
color: 'foreground',
18-
},
19-
})
20-
);
7+
TextProps;
218

229
export const Link: React.FC<LinkProps> = props => (
23-
<LinkElement
10+
<Text
11+
as="a"
2412
rel={props.target === '_blank' ? 'noopener noreferrer' : null}
13+
css={css({
14+
cursor: 'pointer',
15+
textDecoration: 'none',
16+
transition: 'color ease',
17+
transitionDuration: theme => theme.speeds[2],
18+
':hover, :focus': {
19+
color: 'foreground',
20+
},
21+
})}
2522
{...props}
2623
/>
2724
);

packages/components/src/components/SkeletonText/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import styled, { css as styledcss, keyframes } from 'styled-components';
22
import Color from 'color';
33
import { Element } from '../Element';
44

5-
// export interface ITextProps extends React.HTMLAttributes<HTMLSpanElement> {}
6-
75
const pulse = keyframes`
86
0% { background-position: 100% 50%; }
97
100% { background-position: -100% 50%; }

packages/components/src/components/Text/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ const overflowStyles = {
1414
whiteSpace: 'nowrap',
1515
};
1616

17-
export interface ITextProps extends React.HTMLAttributes<HTMLSpanElement> {
17+
export type TextProps = React.AnchorHTMLAttributes<HTMLSpanElement> & {
1818
size?: number;
1919
align?: string;
2020
weight?: string;
2121
block?: boolean;
2222
maxWidth?: number | string;
2323
variant?: 'body' | 'muted' | 'danger';
2424
dateTime?: string;
25-
}
25+
};
2626

27-
export const Text = styled(Element).attrs({ as: 'span' })<ITextProps>(
27+
export const Text = styled(Element).attrs({ as: 'span' })<TextProps>(
2828
({ size, align, weight, block, variant = 'body', maxWidth, ...props }) =>
2929
css({
3030
fontSize: size || 'inherit', // from theme.fontSizes

0 commit comments

Comments
 (0)