Skip to content

Commit

Permalink
fix(text): fix invalid type names
Browse files Browse the repository at this point in the history
  • Loading branch information
weiwli2 authored and JudyZhuHz committed Sep 19, 2024
1 parent 2d26d8f commit a4eb742
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/components/Text/Text.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const TYPES: Record<string, FontStyle> = {
HIGHLIGHT_COMPACT: 'highlight-compact',
BODY_COMPACT: 'body-compact',
LABEL_COMPACT: 'label-compact',
BUTTON_PRIMARY: 'button-primary',
LIST_ITEM: 'list-item',
SPAN: 'span',
DIV: 'div',
};

const STYLE = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const Text: FC<Props> = (props: Props) => {
case TYPES.HYPERLINK_PRIMARY:
return 'p';

case TYPES.BUTTON_PRIMARY:
case TYPES.SPAN:
return 'span';

case TYPES.LIST_ITEM:
case TYPES.DIV:
return 'div';

case TYPES.BODY_SECONDARY:
Expand Down
4 changes: 2 additions & 2 deletions src/components/Text/Text.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ export type FontStyle =
| 'highlight-compact'
| 'body-compact'
| 'label-compact'
| 'button-primary'
| 'list-item';
| 'span'
| 'div';
88 changes: 44 additions & 44 deletions src/components/Text/Text.unit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,22 @@ exports[`Text should match snapshot with type 1`] = `
</Text>
<Text
key="18"
type="button-primary"
type="span"
>
<span
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</span>
</Text>
<Text
key="19"
type="list-item"
type="div"
>
<div
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</div>
Expand Down Expand Up @@ -500,23 +500,23 @@ exports[`Text should match snapshot with type and tagName override 1`] = `
<Text
key="18"
tagName="h1"
type="button-primary"
type="span"
>
<h1
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h1>
</Text>
<Text
key="19"
tagName="h1"
type="list-item"
type="div"
>
<h1
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h1>
Expand Down Expand Up @@ -745,23 +745,23 @@ exports[`Text should match snapshot with type and tagName override 2`] = `
<Text
key="18"
tagName="h2"
type="button-primary"
type="span"
>
<h2
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h2>
</Text>
<Text
key="19"
tagName="h2"
type="list-item"
type="div"
>
<h2
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h2>
Expand Down Expand Up @@ -990,23 +990,23 @@ exports[`Text should match snapshot with type and tagName override 3`] = `
<Text
key="18"
tagName="h3"
type="button-primary"
type="span"
>
<h3
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h3>
</Text>
<Text
key="19"
tagName="h3"
type="list-item"
type="div"
>
<h3
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h3>
Expand Down Expand Up @@ -1235,23 +1235,23 @@ exports[`Text should match snapshot with type and tagName override 4`] = `
<Text
key="18"
tagName="h4"
type="button-primary"
type="span"
>
<h4
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h4>
</Text>
<Text
key="19"
tagName="h4"
type="list-item"
type="div"
>
<h4
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h4>
Expand Down Expand Up @@ -1480,23 +1480,23 @@ exports[`Text should match snapshot with type and tagName override 5`] = `
<Text
key="18"
tagName="h5"
type="button-primary"
type="span"
>
<h5
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h5>
</Text>
<Text
key="19"
tagName="h5"
type="list-item"
type="div"
>
<h5
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h5>
Expand Down Expand Up @@ -1725,23 +1725,23 @@ exports[`Text should match snapshot with type and tagName override 6`] = `
<Text
key="18"
tagName="h6"
type="button-primary"
type="span"
>
<h6
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</h6>
</Text>
<Text
key="19"
tagName="h6"
type="list-item"
type="div"
>
<h6
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</h6>
Expand Down Expand Up @@ -1970,23 +1970,23 @@ exports[`Text should match snapshot with type and tagName override 7`] = `
<Text
key="18"
tagName="p"
type="button-primary"
type="span"
>
<p
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</p>
</Text>
<Text
key="19"
tagName="p"
type="list-item"
type="div"
>
<p
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</p>
Expand Down Expand Up @@ -2215,23 +2215,23 @@ exports[`Text should match snapshot with type and tagName override 8`] = `
<Text
key="18"
tagName="small"
type="button-primary"
type="span"
>
<small
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</small>
</Text>
<Text
key="19"
tagName="small"
type="list-item"
type="div"
>
<small
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</small>
Expand Down Expand Up @@ -2460,23 +2460,23 @@ exports[`Text should match snapshot with type and tagName override 9`] = `
<Text
key="18"
tagName="div"
type="button-primary"
type="span"
>
<div
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</div>
</Text>
<Text
key="19"
tagName="div"
type="list-item"
type="div"
>
<div
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</div>
Expand Down Expand Up @@ -2705,23 +2705,23 @@ exports[`Text should match snapshot with type and tagName override 10`] = `
<Text
key="18"
tagName="span"
type="button-primary"
type="span"
>
<span
className="md-text-wrapper"
data-type="button-primary"
data-type="span"
>
Example Text
</span>
</Text>
<Text
key="19"
tagName="span"
type="list-item"
type="div"
>
<span
className="md-text-wrapper"
data-type="list-item"
data-type="div"
>
Example Text
</span>
Expand Down

0 comments on commit a4eb742

Please sign in to comment.