Skip to content

Commit 152ab98

Browse files
authored
fix(components): wrap Button string children with Text (#1705)
1 parent 369667c commit 152ab98

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/petite-teeth-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@launchpad-ui/components": patch
3+
---
4+
5+
Wrap `Button` string children with `Text`

packages/components/src/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { PerceivableContext } from './Perceivable';
1515
import { ProgressBar } from './ProgressBar';
1616
import styles from './styles/Button.module.css';
17+
import { Text } from './Text';
1718
import { useLPContextProps } from './utils';
1819

1920
const buttonStyles = cva(styles.base, {
@@ -71,7 +72,7 @@ const Button = ({ ref, ...props }: ButtonProps) => {
7172
{isPending && (
7273
<ProgressBar isIndeterminate aria-label="loading" className={styles.progress} />
7374
)}
74-
{children}
75+
{typeof children === 'string' ? <Text>{children}</Text> : children}
7576
</Provider>
7677
))}
7778
</AriaButton>

packages/components/stories/Button.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const Pending: Story = {
147147
return <Button isPending={isPending} onPress={handlePress} {...args} />;
148148
},
149149
args: {
150-
children: <Text>Pending</Text>,
150+
children: 'Pending',
151151
},
152152
play: async ({ canvasElement }) => {
153153
const canvas = within(canvasElement);

0 commit comments

Comments
 (0)