Skip to content

Commit

Permalink
[Inline Code]: Update children prop (#4109)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
PixeledCode and kodiakhq[bot] authored Oct 16, 2024
1 parent 0d10a08 commit 7425ece
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/spicy-badgers-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/inline-code": patch
"@twilio-paste/core": patch
---

[Inline Code]: Update children prop to accept `React.ReactNode` instead of `string`
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as React from "react";
type InlineCodeVariants = "default" | "minimal";

export interface InlineCodeProps extends Partial<Omit<HTMLPasteProps<"div">, "children">> {
children: string;
children: React.ReactNode;
/**
* Overrides the default element name to apply unique styles with the Customization Provider.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Heading } from "@twilio-paste/heading";
import { Stack } from "@twilio-paste/stack";
import { Text } from "@twilio-paste/text";
import { useTheme } from "@twilio-paste/theme";
import { Truncate } from "@twilio-paste/truncate";
import * as React from "react";

import { InlineCode } from "../src";
Expand Down Expand Up @@ -94,6 +95,16 @@ export const DisplayingAPIKey: StoryFn = () => {
);
};

export const WithTruncate: StoryFn = () => {
return (
<Box maxWidth="size20">
<InlineCode>
<Truncate title="Some very long text to truncate">Some very long text to truncate</Truncate>
</InlineCode>
</Box>
);
};

export const Customization: StoryFn = (_args, { parameters: { isTestEnvironment } }) => {
const currentTheme = useTheme();
return (
Expand Down

0 comments on commit 7425ece

Please sign in to comment.