Skip to content

Commit

Permalink
no |
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi committed Jan 10, 2025
1 parent fa9f8be commit aa5d99f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,11 @@ const baseStackFrame = {
export const SimpleCodeFrame: Story = {
args: {
stackFrame: baseStackFrame,
codeFrame: ` 8 | function MyComponent() {
9 | return (
> 10 | <div>Hello World</div>
codeFrame: ` 8 | \u001b[31mfunction\u001b[39m \u001b[31mMyComponent\u001b[39m() {
9 | \u001b[31mreturn\u001b[39m (
> 10 | <\u001b[31mdiv\u001b[39m>Hello \u001b[31mWorld\u001b[39m</\u001b[31mdiv\u001b[39m>
| ^
11 | )
12 | }`,
},
}

export const WithSyntaxHighlighting: Story = {
args: {
stackFrame: baseStackFrame,
codeFrame: ` 8 | function MyComponent() {
9 | return (
> 10 | \u001b[31m<div>\u001b[39mHello World\u001b[31m</div>\u001b[39m
| ^
11 | )
12 | }`,
},
}

export const LongIndentation: Story = {
args: {
stackFrame: baseStackFrame,
codeFrame: ` 8 | function deeplyNested() {
9 | return (
> 10 | <div>
| ^
11 | Deeply Nested Content
12 | </div>`,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) {
.map((line, a) =>
~(a = line.indexOf('|'))
? line.substring(0, a) +
line.substring(a).replace(`^\\ {${miniLeadingSpacesLength}}`, '')
line
.substring(a + 1)
.replace(`^\\ {${miniLeadingSpacesLength}}`, '')
: line
)
.join('\n')
Expand Down Expand Up @@ -113,6 +115,7 @@ export const CODE_FRAME_STYLES = css`
.code-frame-header {
border-top: 1px solid var(--color-gray-400);
border-bottom: 1px solid var(--color-gray-400);
}
[data-nextjs-codeframe]::selection,
Expand Down

0 comments on commit aa5d99f

Please sign in to comment.