Skip to content

Commit e4d18a8

Browse files
Merge pull request #127 from linked-planet/dev
Dev
2 parents a233796 + 90eba79 commit e4d18a8

File tree

6 files changed

+448
-362
lines changed

6 files changed

+448
-362
lines changed

library/src/components/HighlightedText.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ export function HighlightedText({
77
highlightClassName,
88
style,
99
containerElement,
10+
caseSensitive,
1011
}: {
1112
text: string
1213
highlightedText: string[] | string
1314
highlightClassName?: string
1415
className?: string
1516
style?: React.CSSProperties
1617
containerElement?: React.ElementType
18+
caseSensitive?: boolean
1719
}) {
1820
const parts = useMemo(() => {
1921
const highlights = Array.isArray(highlightedText)
@@ -22,10 +24,11 @@ export function HighlightedText({
2224
if (!highlights.length) return text
2325
const delimiterRegex = new RegExp(
2426
`(${highlights.map((it) => it.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`,
25-
"g",
27+
caseSensitive ? "g" : "gi",
2628
)
29+
console.log("Case sensitive:", delimiterRegex, highlightedText)
2730
return text.split(delimiterRegex).reduce((acc, it, i) => {
28-
if (highlights.includes(it)) {
31+
if (delimiterRegex.test(it)) {
2932
acc.push(
3033
<span
3134
key={i}
@@ -42,7 +45,7 @@ export function HighlightedText({
4245
acc.push(it)
4346
return acc
4447
}, [] as React.ReactNode[])
45-
}, [text, highlightClassName, highlightedText])
48+
}, [text, highlightClassName, highlightedText, caseSensitive])
4649

4750
const ContainerElement = containerElement || "p"
4851

library/src/layouting/AppLayout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ function Content({
313313
return (
314314
<section
315315
className={twMerge(
316-
"relative grid h-full min-h-0 w-full",
316+
"relative grid size-full min-h-0 overflow-hidden",
317317
className,
318318
)}
319319
data-layout-content="true"
@@ -343,7 +343,7 @@ function Main({
343343
return (
344344
<main
345345
className={twMerge(
346-
"relative m-0 box-border min-h-0 w-full",
346+
"relative m-0 box-border min-h-0 size-full overflow-hidden",
347347
className,
348348
)}
349349
data-layout-main="true"

0 commit comments

Comments
 (0)