Skip to content

Commit

Permalink
chore: update props, fix up types
Browse files Browse the repository at this point in the history
  • Loading branch information
zchsh committed Aug 9, 2023
1 parent acf8565 commit 207301d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/code-block/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import s from './style.module.css'

export interface CodeBlockOptions {
showChrome?: boolean
highlight?: boolean
highlight?: string
lineNumbers?: boolean
showClipboard?: boolean
showWindowBar?: boolean
Expand Down Expand Up @@ -49,7 +49,6 @@ function CodeBlock({
onCopyCallBack,
options = {
showChrome: false,
highlight: false,
lineNumbers: false,
showClipboard: false,
showWindowBar: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/code-block/partials/code-lines/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
*/
/* eslint-disable react/no-array-index-key */

import React, { PropsWithChildren, useMemo } from 'react'
import React, { PropsWithChildren, ReactElement, useMemo } from 'react'
import classNames from 'classnames'
import parseHighlightedLines from '../../utils/parse-highlighted-lines'
import splitJsxIntoLines from './utils/split-jsx-into-lines'
import splitHtmlIntoLines from './utils/split-html-into-lines'
import s from './code-lines.module.css'

interface CodeLinesProps {
code: string
language: string
code: string | ReactElement
language?: string
lineNumbers?: boolean
highlight?: string
hasFloatingCopyButton?: boolean
Expand Down Expand Up @@ -140,7 +140,7 @@ function CodeLines({
function PreCode({
children,
language,
}: PropsWithChildren<{ language: string }>) {
}: PropsWithChildren<{ language?: string }>) {
return (
<pre className={classNames(s.pre, `language-${language}`)}>
<code className={classNames(s.code, `language-${language}`)}>
Expand Down
5 changes: 5 additions & 0 deletions packages/code-block/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ module.exports = {
description:
'Set to `true` to show the copy-to-clipboard prompt and functionality.',
},
wrapCode: {
type: 'boolean',
description:
'Set to `true` to make long lines of code wrap rather than overflow.',
},
},
},
}

0 comments on commit 207301d

Please sign in to comment.