Skip to content

Commit 27039cb

Browse files
authored
Merge pull request #50 from Jim-Hodapp-Coaching/adjust_tiptap_editor_dark_mode_styling
Fix dark mode style for TipTap component toolbar buttons
2 parents a1d2f69 + dd97cf3 commit 27039cb

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

src/app/coaching-sessions/[id]/page.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ export default function CoachingSessionsPage() {
234234
className="w-[260px] text-sm"
235235
side="left"
236236
>
237-
To view changes to the Notes made by someone else during this
238-
session, before making any new changes yourself, click this
239-
button.
237+
To view any changes made to Notes by another session
238+
participant before making new changes, click this button.
240239
</HoverCardContent>
241240
</HoverCard>
242241
</div>

src/components/ui/coaching-sessions/tiptap-editor.tsx

+24-23
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
121121
<Button
122122
variant="ghost"
123123
onClick={() => editor.chain().focus().toggleBold().run()}
124-
className={`p-2 rounded ${
125-
editor.isActive("bold") ? "bg-gray-200" : ""
124+
className={`p-2 mr-0.5 rounded ${
125+
editor.isActive("bold") ? "button-active" : ""
126126
}`}
127127
title="Bold (Ctrl+B)"
128128
>
@@ -133,8 +133,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
133133
<Button
134134
variant="ghost"
135135
onClick={() => editor.chain().focus().toggleItalic().run()}
136-
className={`p-2 rounded ${
137-
editor.isActive("italic") ? "bg-gray-200" : ""
136+
className={`p-2 mr-0.5 rounded ${
137+
editor.isActive("italic") ? "button-active" : ""
138138
}`}
139139
title="Italic (Ctrl+I)"
140140
>
@@ -145,8 +145,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
145145
<Button
146146
variant="ghost"
147147
onClick={() => editor.chain().focus().toggleUnderline().run()}
148-
className={`p-2 rounded ${
149-
editor.isActive("underline") ? "bg-gray-200" : ""
148+
className={`p-2 mr-0.5 rounded ${
149+
editor.isActive("underline") ? "button-active" : ""
150150
}`}
151151
title="Underline (Ctrl+U)"
152152
>
@@ -157,9 +157,10 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
157157
<Button
158158
variant="ghost"
159159
onClick={() => editor.chain().focus().toggleStrike().run()}
160-
className={`p-2 rounded ${
161-
editor.isActive("strike") ? "bg-gray-200" : ""
162-
}`}
160+
className={`p-2 mr-0.5 rounded ${
161+
editor.isActive("strike") ? "button-active" : ""
162+
}
163+
`}
163164
title="Strike Through"
164165
>
165166
<Strikethrough className="h-4 w-4" />
@@ -169,8 +170,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
169170
<Button
170171
variant="ghost"
171172
onClick={() => editor.chain().focus().toggleHighlight().run()}
172-
className={`p-2 rounded ${
173-
editor.isActive("highlight") ? "bg-gray-200" : ""
173+
className={`p-2 mr-0.5 rounded ${
174+
editor.isActive("highlight") ? "button-active" : ""
174175
}`}
175176
title="Highlight Text"
176177
>
@@ -183,8 +184,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
183184
onClick={() =>
184185
editor.chain().focus().toggleHeading({ level: 1 }).run()
185186
}
186-
className={`p-2 rounded ${
187-
editor.isActive("heading", { level: 1 }) ? "bg-gray-200" : ""
187+
className={`p-2 mr-0.5 rounded ${
188+
editor.isActive("heading", { level: 1 }) ? "button-active" : ""
188189
}`}
189190
title="Heading1"
190191
>
@@ -197,8 +198,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
197198
onClick={() =>
198199
editor.chain().focus().toggleHeading({ level: 2 }).run()
199200
}
200-
className={`p-2 rounded ${
201-
editor.isActive("heading", { level: 2 }) ? "bg-gray-200" : ""
201+
className={`p-2 mr-0.5 rounded ${
202+
editor.isActive("heading", { level: 2 }) ? "button-active" : ""
202203
}`}
203204
title="Heading2"
204205
>
@@ -211,8 +212,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
211212
onClick={() =>
212213
editor.chain().focus().toggleHeading({ level: 3 }).run()
213214
}
214-
className={`p-2 rounded ${
215-
editor.isActive("heading", { level: 3 }) ? "bg-gray-200" : ""
215+
className={`p-2 mr-0.5 rounded ${
216+
editor.isActive("heading", { level: 3 }) ? "button-active" : ""
216217
}`}
217218
title="Heading3"
218219
>
@@ -223,8 +224,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
223224
<Button
224225
variant="ghost"
225226
onClick={() => editor.chain().focus().toggleBulletList().run()}
226-
className={`p-2 rounded ${
227-
editor.isActive("bulletList") ? "bg-gray-200" : ""
227+
className={`p-2 mr-0.5 rounded ${
228+
editor.isActive("bulletList") ? "button-active" : ""
228229
}`}
229230
title="Bullet List"
230231
>
@@ -235,8 +236,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
235236
<Button
236237
variant="ghost"
237238
onClick={() => editor.chain().focus().toggleOrderedList().run()}
238-
className={`p-2 rounded ${
239-
editor.isActive("orderedList") ? "bg-gray-200" : ""
239+
className={`p-2 mr-0.5 rounded ${
240+
editor.isActive("orderedList") ? "button-active" : ""
240241
}`}
241242
title="Ordered List"
242243
>
@@ -246,8 +247,8 @@ const TipTapEditor = forwardRef<EditorRef, TipTapProps>(
246247
<Button
247248
variant="ghost"
248249
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
249-
className={`p-2 rounded ${
250-
editor.isActive("codeBlock") ? "is-active" : ""
250+
className={`p-2 mr-0.5 rounded ${
251+
editor.isActive("codeBlock") ? "button-active" : ""
251252
}`}
252253
>
253254
<Braces className="h-4 w-4" />

src/styles/styles.scss

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
margin-top: 0;
1111
}
1212

13+
14+
1315
/* List styles */
1416
ul,
1517
ol {
@@ -146,3 +148,10 @@
146148
margin: 2rem 0;
147149
}
148150
}
151+
152+
// Toolbar button styling for an active (i.e. toggled on) light/dark mode
153+
.button-active {
154+
@apply bg-gray-200;
155+
@apply dark:text-black;
156+
@apply hover:dark:text-white;
157+
}

0 commit comments

Comments
 (0)