Skip to content

Commit

Permalink
✨ feat: Add wrap to highlihter props
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Jul 26, 2024
1 parent 5a94c8c commit 1dd8ff6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/Highlighter/demos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default () => {
options: ['ghost', 'block', 'pure'],
value: 'block',
},
wrap: false,
},
{ store },
);
Expand Down
4 changes: 3 additions & 1 deletion src/Highlighter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface HighlighterProps extends DivProps {
* @default 'block'
*/
type?: 'ghost' | 'block' | 'pure';
wrap?: boolean;
}

export const Highlighter = memo<HighlighterProps>(
Expand All @@ -62,10 +63,11 @@ export const Highlighter = memo<HighlighterProps>(
allowChangeLanguage = true,
fileName,
icon,
wrap,
...rest
}) => {
const { styles, cx } = useStyles(type);
const container = cx(styles.container, className);
const container = cx(styles.container, !wrap && styles.nowrap, className);

if (fullFeatured)
return (
Expand Down
6 changes: 5 additions & 1 deletion src/Highlighter/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const useStyles = createStyles(
}
code {
text-wrap: nowrap !important;
background: transparent !important;
}
`,
Expand All @@ -90,6 +89,11 @@ export const useStyles = createStyles(
transition: opacity 0.1s;
`,
),
nowrap: css`
code {
text-wrap: nowrap !important;
}
`,
scroller: css`
overflow: auto;
width: 100%;
Expand Down
25 changes: 0 additions & 25 deletions src/Markdown/utils.test.ts

This file was deleted.

0 comments on commit 1dd8ff6

Please sign in to comment.