Skip to content

Commit 676f340

Browse files
authored
Merge pull request #3265 from codecrafters-io/dark-mode-comment-styles-update
style: update comment form and comment card styles for dark mode
2 parents 35a5ffd + c8a101b commit 676f340

File tree

7 files changed

+35
-33
lines changed

7 files changed

+35
-33
lines changed

app/components/comment-card/index.hbs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{{if
1818
@comment.parentComment
1919
'py-1'
20-
'bg-gray-100 dark:bg-gray-800 rounded-t py-2 px-4 border-b border-gray-200 dark:border-white/5 shadow-xs'
20+
'bg-gray-100 dark:bg-gray-825 rounded-t py-2 px-4 border-b border-gray-200 dark:border-white/5 shadow-xs'
2121
}}"
2222
>
2323
<div class="flex items-center flex-wrap">
@@ -30,15 +30,10 @@
3030
{{@comment.user.username}}
3131
</a>
3232

33-
<UserLabel @user={{@comment.user}} @context={{@comment.contextForUserLabel}} class="ml-1" />
34-
35-
{{#if (eq @comment.user.username "codecrafters-bot")}}
36-
<span class="bg-gray-400 dark:bg-gray-500 text-white ml-1 px-1 py-0.5 rounded-sm font-semibold text-xs">
37-
bot
38-
</span>
39-
{{/if}}
33+
<UserLabel @user={{@comment.user}} @context={{@comment.contextForUserLabel}} class="ml-1.5" />
4034

4135
<div class="bg-gray-300 dark:bg-white/5 w-1 h-1 ml-1.5 mr-1.5 rounded-full"></div>
36+
4237
<div class="text-xs text-gray-400 dark:text-gray-500">
4338
{{date-from-now @comment.createdAt}}
4439
</div>
@@ -128,7 +123,7 @@
128123
{{/if}}
129124

130125
{{#if (gt this.visibleChildComments.length 0)}}
131-
<div class="bg-gray-50 dark:bg-gray-800 py-2 px-4 border-t border-gray-200 dark:border-white/5 {{if this.shouldShowReplyForm '' 'rounded-b'}}">
126+
<div class="bg-gray-50 dark:bg-gray-825 py-2 px-4 border-t border-gray-200 dark:border-white/5 {{if this.shouldShowReplyForm '' 'rounded-b'}}">
132127
{{#each this.visibleChildComments as |childComment|}}
133128
<div class="flex items-start">
134129
<a href={{childComment.user.codecraftersProfileUrl}} class="mt-0.5 flex items-center shrink-0" target="_blank" rel="noopener noreferrer">
@@ -156,7 +151,7 @@
156151
Hide rejected replies
157152
</TertiaryButton>
158153
</div>
159-
<div class="bg-gray-50 dark:bg-gray-800 py-2 px-4 border-t border-gray-200 dark:border-white/5 rounded-b">
154+
<div class="bg-gray-50 dark:bg-gray-825 py-2 px-4 border-t border-gray-200 dark:border-white/5 rounded-b">
160155
{{#each this.rejectedChildComments as |childComment|}}
161156
<div class="flex items-start">
162157
<a href={{childComment.user.codecraftersProfileUrl}} class="mt-0.5 flex items-center shrink-0" target="_blank" rel="noopener noreferrer">

app/components/comment-form/index.hbs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
<div class="w-full bg-white dark:bg-gray-850" data-test-comment-form ...attributes {{will-destroy this.handleWillDestroy}}>
22
<div
3-
class="bg-gray-100 dark:bg-gray-800 pt-1.5 px-2 border-b border-gray-300 dark:border-white/10 flex items-center
4-
{{if this.isReplying '' 'rounded-t'}}"
3+
class="bg-gray-100 dark:bg-gray-825 pr-2 border-b border-gray-300 dark:border-white/10 flex items-center {{if this.isReplying '' 'rounded-t'}}"
54
>
6-
<div class="transform translate-y-px flex">
5+
<div class="-mt-px -ml-px -mb-px flex">
76
{{! @glint-expect-error Not ts-ified yet}}
87
<CommentForm::TabHeader @text="Write" @isActive={{eq this.activeTab "write"}} {{on "click" (fn this.setActiveTab "write")}} />
98

109
{{! @glint-expect-error Not ts-ified yet}}
11-
<CommentForm::TabHeader
12-
@text="Preview"
13-
@isActive={{eq this.activeTab "preview"}}
14-
{{on "click" (fn this.setActiveTab "preview")}}
15-
class="ml-1"
16-
/>
10+
<CommentForm::TabHeader @text="Preview" @isActive={{eq this.activeTab "preview"}} {{on "click" (fn this.setActiveTab "preview")}} />
1711
</div>
1812
</div>
1913

@@ -24,7 +18,7 @@
2418
<Textarea
2519
{{! @glint-expect-error commentMarkdown is typed as a computed prop?}}
2620
@value={{this.comment.bodyMarkdown}}
27-
class="text-black dark:text-white leading-relaxed border border-gray-300 dark:border-white/10 rounded-sm w-full p-2 text-sm bg-gray-100 dark:bg-gray-800 focus:bg-white dark:focus:bg-gray-800 placeholder-gray-500 dark:placeholder-gray-500 focus:outline-hidden focus:ring-2 focus:ring-teal-600"
21+
class="text-black dark:text-white leading-relaxed border border-gray-300 dark:border-white/10 rounded-sm w-full p-2 text-sm bg-white dark:bg-gray-850 focus:bg-white dark:focus:bg-gray-850 placeholder-gray-500 dark:placeholder-gray-500 focus:outline-hidden focus:ring-2 focus:ring-teal-600"
2822
placeholder={{this.placeholderText}}
2923
rows="5"
3024
required="true"

app/components/comment-form/tab-header.hbs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{{! @glint-nocheck: not typesafe yet }}
22
<div
3-
class="py-2 px-4 border border-b-0
4-
{{if @isActive 'bg-white dark:bg-gray-850 border-gray-300 dark:border-white/10' 'border-transparent'}}
5-
rounded-t text-sm text-gray-800 dark:text-gray-50"
3+
class="py-2.5 px-4 border border-b-0
4+
{{if
5+
@isActive
6+
'bg-white dark:bg-gray-850 border-gray-300 dark:border-white/10 text-gray-800 dark:text-gray-50'
7+
'border-transparent text-gray-600 dark:text-gray-300'
8+
}}
9+
rounded-t text-sm"
610
role="button"
711
data-test-tab-header
812
...attributes

app/components/user-label.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{#if this.label}}
2-
<span class="bg-gray-400 text-white px-1 py-0.5 rounded-sm font-semibold text-xs" data-test-user-label ...attributes>
2+
<Pill @color="gray" data-test-user-label ...attributes>
33
{{this.label.text}}
44
<EmberTooltip @text={{this.label.tooltipText}} />
5-
</span>
5+
</Pill>
66
{{/if}}

app/components/user-label.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,19 @@ export default class UserLabel extends Component<UserLabelSignature> {
4949
text: 'challenge author',
5050
tooltipText: 'This user is the author of one or more CodeCrafters challenges',
5151
};
52+
} else if (this.args.user.username === 'codecrafters-bot') {
53+
return {
54+
text: 'bot',
55+
tooltipText: 'Your friendly neighborhood bot',
56+
};
5257
} else {
5358
return null;
5459
}
5560
}
5661
}
62+
63+
declare module '@glint/environment-ember-loose/registry' {
64+
export default interface Registry {
65+
UserLabel: typeof UserLabel;
66+
}
67+
}

app/components/user-page/sidebar-container.hbs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,13 @@
4646
{{/if}}
4747

4848
<div class="flex flex-col gap-4">
49-
<div>
50-
<div class="text-xs text-gray-400">
51-
joined
52-
{{date-from-now @user.createdAt}}
53-
</div>
54-
55-
{{! @glint-expect-error not ts-ified yet }}
56-
<UserLabel @user={{@user}} />
49+
<div class="text-xs text-gray-400">
50+
joined
51+
{{date-from-now @user.createdAt}}
5752
</div>
5853

54+
<UserLabel @user={{@user}} class="self-start" />
55+
5956
{{#if this.currentUser.isAdmin}}
6057
<TertiaryButton @size="extra-small" data-test-admin-profile-button class="w-fit">
6158
<a href={{@user.adminProfileUrl}} target="_blank" rel="noopener noreferrer">Admin Profile</a>

app/tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = {
4444
},
4545
colors: {
4646
gray: {
47+
825: '#1A2538',
4748
850: '#172033',
4849
925: '#0A1120',
4950
},

0 commit comments

Comments
 (0)