Skip to content

Commit d8a5ed2

Browse files
authored
fix: Badge and Tag rendering a span (#208)
1 parent ca620a0 commit d8a5ed2

27 files changed

+33
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
import { Tag } from '../..';
4+
import { Tag } from '../Tag';
55

66
export function Badge(props) {
7-
return <Tag round {...props} />;
7+
return <Tag {...props} round />;
88
}
99

1010
Badge.propTypes = {
11-
variant: PropTypes.oneOf(['secondary', 'primary', 'danger']),
1211
disabled: PropTypes.bool,
12+
variant: PropTypes.oneOf(['secondary', 'primary', 'danger']),
1313
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import { Badge } from '.';
5+
6+
it('renders without crashing', () => {
7+
const div = document.createElement('div');
8+
ReactDOM.render(<Badge />, div);
9+
ReactDOM.unmountComponentAtNode(div);
10+
});

packages/fuselage/src/components/Badge/stories.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { Meta, Preview, Props, Story } from '@storybook/addon-docs/blocks';
22

33
import { Badge } from '../..';
44

5-
<Meta title='Tags & Badges/Badges' parameters={{ jest: ['Button/spec'] }} />
5+
<Meta title='Data Display/Badge' parameters={{ jest: ['Badge/spec'] }} />
66

77
# Badge
88

9-
Used for mentions.
9+
Shows a count.
1010

1111
<Preview>
1212
<Story name='Default'>

packages/fuselage/src/components/Tag/index.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ import PropTypes from 'prop-types';
44
import { Box } from '../..';
55

66
export function Tag({
7-
variant = 'secondary',
87
disabled,
9-
textStyle = 'micro',
108
round,
9+
variant = 'secondary',
1110
onClick,
1211
...props
1312
}) {
1413
return <Box
15-
is='div'
16-
textStyle={textStyle}
1714
componentClassName='rcx-tag'
15+
is='span'
1816
mod-secondary={variant === 'secondary'}
1917
mod-primary={variant === 'primary'}
2018
mod-danger={variant === 'danger'}
@@ -28,10 +26,7 @@ export function Tag({
2826
}
2927

3028
Tag.propTypes = {
31-
textStyle: PropTypes.oneOf([
32-
'h1', 's1', 's2', 'p1', 'p2', 'c1', 'c2', 'micro',
33-
]),
34-
variant: PropTypes.oneOf(['secondary', 'primary', 'danger']),
35-
round: PropTypes.bool,
3629
disabled: PropTypes.bool,
30+
round: PropTypes.bool,
31+
variant: PropTypes.oneOf(['secondary', 'primary', 'danger']),
3732
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import { Tag } from '.';
5+
6+
it('renders without crashing', () => {
7+
const div = document.createElement('div');
8+
ReactDOM.render(<Tag />, div);
9+
ReactDOM.unmountComponentAtNode(div);
10+
});

packages/fuselage/src/components/Tag/stories.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Meta, Preview, Props, Story } from '@storybook/addon-docs/blocks';
22

33
import { Tag } from '../..';
44

5-
<Meta title='Tags & Badges/Tags' parameters={{ jest: ['Button/spec'] }} />
5+
<Meta title='Data Display/Tag' parameters={{ jest: ['Tag/spec'] }} />
66

77
# Tag
88

packages/fuselage/src/components/Tag/styles.scss

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@use '../../styles/colors.scss';
22
@use '../../styles/lengths.scss';
3+
@use '../../styles/typography.scss';
34

45
$tag-colors-secondary-color: theme('tag-colors-secondary-color', colors.foreground(primary));
56
$tag-colors-secondary-background-color: theme('tag-colors-secondary-background-color', colors.primary(100));
@@ -31,6 +32,8 @@ $tag-colors-disabled-background-color: theme('tag-colors-disabled-background-col
3132

3233
border-radius: lengths.border-radius(4);
3334

35+
@include typography.use-font-scale(micro);
36+
3437
&--secondary {
3538
color: $tag-colors-secondary-color;
3639
background-color: $tag-colors-secondary-background-color;

0 commit comments

Comments
 (0)