Skip to content

Commit ccf19d6

Browse files
authored
Merge pull request #35870 from quentinguidee/refine-about-files
Refine file comments design
2 parents b90ccaa + d5d804b commit ccf19d6

3 files changed

Lines changed: 87 additions & 75 deletions

File tree

apps/comments/src/components/Comment.vue

Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -24,75 +24,79 @@
2424
:class="{'comment--loading': loading}"
2525
class="comment">
2626
<!-- Comment header toolbar -->
27-
<div class="comment__header">
27+
<div class="comment__side">
2828
<!-- Author -->
2929
<NcAvatar class="comment__avatar"
3030
:display-name="actorDisplayName"
3131
:user="actorId"
3232
:size="32" />
33-
<span class="comment__author">{{ actorDisplayName }}</span>
34-
35-
<!-- Comment actions,
36-
show if we have a message id and current user is author -->
37-
<NcActions v-if="isOwnComment && id && !loading" class="comment__actions">
38-
<template v-if="!editing">
39-
<NcActionButton :close-after-click="true"
40-
icon="icon-rename"
41-
@click="onEdit">
42-
{{ t('comments', 'Edit comment') }}
43-
</NcActionButton>
44-
<NcActionSeparator />
45-
<NcActionButton :close-after-click="true"
46-
icon="icon-delete"
47-
@click="onDeleteWithUndo">
48-
{{ t('comments', 'Delete comment') }}
49-
</NcActionButton>
50-
</template>
51-
52-
<NcActionButton v-else
53-
icon="icon-close"
54-
@click="onEditCancel">
55-
{{ t('comments', 'Cancel edit') }}
56-
</NcActionButton>
57-
</NcActions>
58-
59-
<!-- Show loading if we're editing or deleting, not on new ones -->
60-
<div v-if="id && loading" class="comment_loading icon-loading-small" />
61-
62-
<!-- Relative time to the comment creation -->
63-
<Moment v-else-if="creationDateTime" class="comment__timestamp" :timestamp="timestamp" />
6433
</div>
65-
66-
<!-- Message editor -->
67-
<div v-if="editor || editing" class="comment__editor ">
68-
<NcRichContenteditable ref="editor"
69-
:auto-complete="autoComplete"
70-
:contenteditable="!loading"
71-
:value="localMessage"
72-
:user-data="userData"
73-
@update:value="updateLocalMessage"
74-
@submit="onSubmit" />
75-
<NcButton class="comment__submit"
76-
type="tertiary-no-background"
77-
native-type="submit"
78-
:aria-label="t('comments', 'Post comment')"
79-
:disabled="isEmptyMessage"
80-
@click="onSubmit">
81-
<template #icon>
82-
<span v-if="loading" class="icon-loading-small" />
83-
<ArrowRight v-else :size="20" />
84-
</template>
85-
</NcButton>
34+
<div class="comment__body">
35+
<div class="comment__header">
36+
<span class="comment__author">{{ actorDisplayName }}</span>
37+
38+
<!-- Comment actions,
39+
show if we have a message id and current user is author -->
40+
<NcActions v-if="isOwnComment && id && !loading" class="comment__actions">
41+
<template v-if="!editing">
42+
<NcActionButton :close-after-click="true"
43+
icon="icon-rename"
44+
@click="onEdit">
45+
{{ t('comments', 'Edit comment') }}
46+
</NcActionButton>
47+
<NcActionSeparator />
48+
<NcActionButton :close-after-click="true"
49+
icon="icon-delete"
50+
@click="onDeleteWithUndo">
51+
{{ t('comments', 'Delete comment') }}
52+
</NcActionButton>
53+
</template>
54+
55+
<NcActionButton v-else
56+
icon="icon-close"
57+
@click="onEditCancel">
58+
{{ t('comments', 'Cancel edit') }}
59+
</NcActionButton>
60+
</NcActions>
61+
62+
<!-- Show loading if we're editing or deleting, not on new ones -->
63+
<div v-if="id && loading" class="comment_loading icon-loading-small" />
64+
65+
<!-- Relative time to the comment creation -->
66+
<Moment v-else-if="creationDateTime" class="comment__timestamp" :timestamp="timestamp" />
67+
</div>
68+
69+
<!-- Message editor -->
70+
<div v-if="editor || editing" class="comment__editor ">
71+
<NcRichContenteditable ref="editor"
72+
:auto-complete="autoComplete"
73+
:contenteditable="!loading"
74+
:value="localMessage"
75+
:user-data="userData"
76+
@update:value="updateLocalMessage"
77+
@submit="onSubmit" />
78+
<NcButton class="comment__submit"
79+
type="tertiary-no-background"
80+
native-type="submit"
81+
:aria-label="t('comments', 'Post comment')"
82+
:disabled="isEmptyMessage"
83+
@click="onSubmit">
84+
<template #icon>
85+
<span v-if="loading" class="icon-loading-small" />
86+
<ArrowRight v-else :size="20" />
87+
</template>
88+
</NcButton>
89+
</div>
90+
91+
<!-- Message content -->
92+
<!-- The html is escaped and sanitized before rendering -->
93+
<!-- eslint-disable-next-line vue/no-v-html-->
94+
<div v-else
95+
:class="{'comment__message--expanded': expanded}"
96+
class="comment__message"
97+
@click="onExpand"
98+
v-html="renderedContent" />
8699
</div>
87-
88-
<!-- Message content -->
89-
<!-- The html is escaped and sanitized before rendering -->
90-
<!-- eslint-disable-next-line vue/no-v-html-->
91-
<div v-else
92-
:class="{'comment__message--expanded': expanded}"
93-
class="comment__message"
94-
@click="onExpand"
95-
v-html="renderedContent" />
96100
</div>
97101
</template>
98102

@@ -258,17 +262,29 @@ export default {
258262
$comment-padding: 10px;
259263
260264
.comment {
265+
display: flex;
266+
gap: 16px;
261267
position: relative;
262-
padding: $comment-padding 0 $comment-padding * 1.5;
268+
padding: 5px $comment-padding;
269+
270+
&__side {
271+
display: flex;
272+
align-items: flex-start;
273+
padding-top: 16px;
274+
}
275+
276+
&__body {
277+
display: flex;
278+
flex-grow: 1;
279+
flex-direction: column;
280+
}
263281
264282
&__header {
265283
display: flex;
266284
align-items: center;
267285
min-height: 44px;
268-
padding: math.div($comment-padding, 2) 0;
269286
}
270287
271-
&__author,
272288
&__actions {
273289
margin-left: $comment-padding !important;
274290
}
@@ -283,16 +299,11 @@ $comment-padding: 10px;
283299
&_loading,
284300
&__timestamp {
285301
margin-left: auto;
302+
text-align: right;
303+
white-space: nowrap;
286304
color: var(--color-text-maxcontrast);
287305
}
288306
289-
&__editor,
290-
&__message {
291-
position: relative;
292-
// Avatar size, align with author name
293-
padding-left: 32px + $comment-padding;
294-
}
295-
296307
&__submit {
297308
position: absolute !important;
298309
right: 0;
@@ -306,6 +317,7 @@ $comment-padding: 10px;
306317
word-break: break-word;
307318
max-height: 70px;
308319
overflow: hidden;
320+
margin-top: -6px;
309321
&--expanded {
310322
max-height: none;
311323
overflow: visible;

0 commit comments

Comments
 (0)