Skip to content

Commit 7425ece

Browse files
[Inline Code]: Update children prop (#4109)
* feat(inline-code): update children prop * feat(inline-code): add changeset * feat(inline-code): update changeset --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 0d10a08 commit 7425ece

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.changeset/spicy-badgers-double.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@twilio-paste/inline-code": patch
3+
"@twilio-paste/core": patch
4+
---
5+
6+
[Inline Code]: Update children prop to accept `React.ReactNode` instead of `string`

packages/paste-core/components/inline-code/src/InlineCode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as React from "react";
1010
type InlineCodeVariants = "default" | "minimal";
1111

1212
export interface InlineCodeProps extends Partial<Omit<HTMLPasteProps<"div">, "children">> {
13-
children: string;
13+
children: React.ReactNode;
1414
/**
1515
* Overrides the default element name to apply unique styles with the Customization Provider.
1616
*

packages/paste-core/components/inline-code/stories/index.stories.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Heading } from "@twilio-paste/heading";
55
import { Stack } from "@twilio-paste/stack";
66
import { Text } from "@twilio-paste/text";
77
import { useTheme } from "@twilio-paste/theme";
8+
import { Truncate } from "@twilio-paste/truncate";
89
import * as React from "react";
910

1011
import { InlineCode } from "../src";
@@ -94,6 +95,16 @@ export const DisplayingAPIKey: StoryFn = () => {
9495
);
9596
};
9697

98+
export const WithTruncate: StoryFn = () => {
99+
return (
100+
<Box maxWidth="size20">
101+
<InlineCode>
102+
<Truncate title="Some very long text to truncate">Some very long text to truncate</Truncate>
103+
</InlineCode>
104+
</Box>
105+
);
106+
};
107+
97108
export const Customization: StoryFn = (_args, { parameters: { isTestEnvironment } }) => {
98109
const currentTheme = useTheme();
99110
return (

0 commit comments

Comments
 (0)