Skip to content

Commit

Permalink
fix: restore PR #73, accidentally reverted by 9f0c810
Browse files Browse the repository at this point in the history
  • Loading branch information
FezVrasta committed Apr 18, 2019
1 parent ddda090 commit 6846cb0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
18 changes: 15 additions & 3 deletions packages/react-core/src/Button/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ exports[`renders a Button with small size 1`] = `
className="emotion-0 emotion-1"
type="button"
>
Hello, World!
<span
key=".0"
>
Hello, World!
</span>
</button>
</ForwardRef>
</Button>
Expand Down Expand Up @@ -184,7 +188,11 @@ exports[`renders a disabled and transparent Button 1`] = `
disabled={true}
type="button"
>
Hello, World!
<span
key=".0"
>
Hello, World!
</span>
</button>
</ForwardRef>
</Button>
Expand Down Expand Up @@ -275,7 +283,11 @@ exports[`renders the expected markup 1`] = `
data-action="foo"
type="button"
>
Hello, World!
<span
key=".0"
>
Hello, World!
</span>
</button>
</ForwardRef>
</Button>
Expand Down
13 changes: 12 additions & 1 deletion packages/react-core/src/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const Button = styled(
importance,
disabled,
type,
children,
...props
}: Props,
ref: React.ElementRef<any>
Expand All @@ -98,7 +99,17 @@ const Button = styled(
specificProps = { disabled, type };
}

return <Tag {...specificProps} {...props} ref={ref} />;
return (
<Tag {...specificProps} {...props}>
{React.Children.map(children, node =>
['string', 'number'].includes(typeof node) ? (
<span>{node}</span>
) : (
node
)
)}
</Tag>
);
}
)
)`
Expand Down

0 comments on commit 6846cb0

Please sign in to comment.