Skip to content

Commit 5a507ae

Browse files
Use inline styles for highlighting and comments
- Replace CSS classes with inline styles to ensure visibility - Add backgroundColor inline style for highlighted prop - Add color and opacity inline styles for comment text - This ensures the styling works regardless of CSS class support Co-Authored-By: Colton Berry <[email protected]>
1 parent e1b4045 commit 5a507ae

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

fern/components/File.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export const File: React.FC<FileProps> = ({
1616
className = ''
1717
}) => {
1818
const baseClasses = "grid items-center gap-2 py-1 px-2 rounded transition-colors";
19-
const highlightedClasses = highlighted ? "files-row-highlighted" : "";
2019
const gridClasses = "grid-cols-[24px_24px_1fr_auto]";
21-
const combinedClasses = `${baseClasses} ${gridClasses} ${highlightedClasses} ${className}`.trim();
20+
const combinedClasses = `${baseClasses} ${gridClasses} ${className}`.trim();
2221

22+
const highlightStyle = highlighted ? { backgroundColor: 'rgba(255, 235, 59, 0.15)' } : {};
2323
const formattedComment = comment ? (comment.startsWith('#') ? comment : `# ${comment}`) : null;
2424

2525
const content = (
@@ -39,7 +39,8 @@ export const File: React.FC<FileProps> = ({
3939
{/* Comment */}
4040
{formattedComment && (
4141
<span
42-
className="files-row-comment text-xs font-mono whitespace-nowrap overflow-hidden text-ellipsis"
42+
className="text-xs font-mono whitespace-nowrap overflow-hidden text-ellipsis"
43+
style={{ color: '#6b7280', opacity: 0.8 }}
4344
title={formattedComment}
4445
>
4546
{formattedComment}
@@ -53,14 +54,15 @@ export const File: React.FC<FileProps> = ({
5354
<a
5455
href={href}
5556
className={`${combinedClasses} hover:underline cursor-pointer no-underline`}
57+
style={highlightStyle}
5658
>
5759
{content}
5860
</a>
5961
);
6062
}
6163

6264
return (
63-
<div className={combinedClasses}>
65+
<div className={combinedClasses} style={highlightStyle}>
6466
{content}
6567
</div>
6668
);

fern/components/Folder.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ export const Folder: React.FC<FolderProps> = ({
2222
const [isOpen, setIsOpen] = useState(defaultOpen);
2323

2424
const baseClasses = "grid items-center gap-2 py-1 px-2 rounded transition-colors";
25-
const highlightedClasses = highlighted ? "files-row-highlighted" : "";
2625
const gridClasses = "grid-cols-[24px_24px_1fr_auto]";
27-
const combinedClasses = `${baseClasses} ${gridClasses} ${highlightedClasses}`.trim();
26+
const combinedClasses = `${baseClasses} ${gridClasses}`.trim();
27+
28+
const highlightStyle = highlighted ? { backgroundColor: 'rgba(255, 235, 59, 0.15)' } : {};
2829

2930
const handleToggle = () => {
3031
setIsOpen(!isOpen);
@@ -67,7 +68,8 @@ export const Folder: React.FC<FolderProps> = ({
6768
<span className="text-default text-sm font-mono">{name}</span>
6869
{formattedComment && (
6970
<span
70-
className="files-row-comment text-xs font-mono whitespace-nowrap overflow-hidden text-ellipsis"
71+
className="text-xs font-mono whitespace-nowrap overflow-hidden text-ellipsis"
72+
style={{ color: '#6b7280', opacity: 0.8 }}
7173
title={formattedComment}
7274
>
7375
{formattedComment}
@@ -80,13 +82,15 @@ export const Folder: React.FC<FolderProps> = ({
8082
<a
8183
href={href}
8284
className={`${combinedClasses} hover:underline cursor-pointer no-underline`}
85+
style={highlightStyle}
8386
>
8487
{content}
8588
</a>
8689
) : (
8790
<button
8891
onClick={handleToggle}
8992
className={`${combinedClasses} w-full text-left cursor-pointer border-0 bg-transparent`}
93+
style={highlightStyle}
9094
aria-expanded={isOpen}
9195
type="button"
9296
>

0 commit comments

Comments
 (0)