Skip to content

Commit 7d9b860

Browse files
authored
Comments polish day 1 (codesandbox#3798)
* resolved issues with resolve button * half pixels, can you believe it * scroll to bottom of replies
1 parent 5fb16b3 commit 7d9b860

File tree

2 files changed

+16
-3
lines changed
  • packages
    • app/src/app/pages/Sandbox/Editor/Workspace/screens/Comments/Dialog
    • components/src/components/Icon

2 files changed

+16
-3
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/Comments/Dialog/index.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,16 @@ export const Dialog: React.FC = () => {
144144
/>
145145
) : null}
146146
</Stack>
147-
<AddReply comment={comment} />
147+
<AddReply
148+
comment={comment}
149+
onSubmit={() => {
150+
// scroll to bottom of the list,
151+
// have to wait for it to load though :)
152+
window.requestAnimationFrame(() => {
153+
listRef.current.scrollTop = listRef.current.scrollHeight;
154+
});
155+
}}
156+
/>
148157
</>
149158
)}
150159
</Stack>
@@ -268,6 +277,9 @@ const DialogHeader = ({ comment, hasShadow }) => {
268277
transition: 'color',
269278
transitionDuration: theme => theme.speeds[1],
270279
color: comment.isResolved ? 'green' : 'mutedForeground',
280+
':hover:not(:disabled), :focus:not(:disabled)': {
281+
color: comment.isResolved ? 'green' : 'foreground',
282+
},
271283
})}
272284
/>
273285
<IconButton
@@ -385,7 +397,7 @@ const Replies = ({ replies, repliesRenderedCallback }) => {
385397
);
386398
};
387399

388-
const AddReply = ({ comment }) => {
400+
const AddReply = ({ comment, ...props }) => {
389401
const { actions } = useOvermind();
390402
const [value, setValue] = useState('');
391403

@@ -395,6 +407,7 @@ const AddReply = ({ comment }) => {
395407
content: value,
396408
parentCommentId: comment.id,
397409
});
410+
if (props.onSubmit) props.onSubmit();
398411
};
399412

400413
return (

packages/components/src/components/Icon/icons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const check = props => (
135135
<path
136136
fillRule="evenodd"
137137
clipRule="evenodd"
138-
d="M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM10.9124 5L11.9409 6.02852L7.12513 10.8443L6.09661 9.81577L6.10102 9.81136L4.5 8.21034L5.52852 7.18182L7.12954 8.78284L10.9124 5Z"
138+
d="M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM11.1945 4.57143L12.1707 5.54756L6.45109 11.2671L6.019 10.8351L3.5 8.36104L4.3008 7.54567L6.27821 9.48776L11.1945 4.57143Z"
139139
fill="currentColor"
140140
/>
141141
</Element>

0 commit comments

Comments
 (0)