Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit 092b48d

Browse files
committed
style: fix styles of comments section
1 parent 17da287 commit 092b48d

File tree

7 files changed

+19
-125
lines changed

7 files changed

+19
-125
lines changed

render/actions/__tests__/issues.actions.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe('Issue actions', () => {
2727
expect(issuesActions).toBeTruthy();
2828
expect(issuesActions.ISSUES_GET_PAGE).toBeTruthy();
2929
expect(issuesActions.ISSUES_GET).toBeTruthy();
30-
expect(issuesActions.ISSUES_COMMENTS_SEND).toBeTruthy();
3130
expect(issuesActions.ISSUES_TIME_ENTRY_GET).toBeTruthy();
3231

3332
expect(issuesActions.default.getPage).toBeTruthy();

render/components/Copyrights.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ const Copyrights = () => (
1818

1919
export {
2020
Copyrights
21-
}
21+
};

render/components/Flex.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ReactNode } from 'react';
22
import { css } from '@emotion/react';
33

4-
type FlexAlignment = 'center' | 'flex-start' | 'flex-end' | 'space-around' | 'space-between';
4+
type FlexAlignment = 'center' | 'flex-start' | 'flex-end' | 'space-around' | 'space-between' | 'stretch';
55

66
type FlexProps = {
77
children?: ReactNode;

render/components/Iframe.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Iframe = ({
3131
const handleResize = useCallback(throttle(() => {
3232
if (iframe) {
3333
iframe.height = iframe.contentDocument.body.scrollHeight + 30;
34-
iframe.width = width ? width : iframe.contentDocument.body.scrollWidth || 0;
34+
iframe.width = width || iframe.contentDocument.body.scrollWidth || 0;
3535
}
3636

3737
if (onResize) {

render/components/IssueDetailsPage/CommentsSection.tsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DateComponent from '../Date';
1010
import { useOvermindActions, useOvermindState } from '../../store';
1111
import { theme as Theme } from '../../theme';
1212
import type { Issue } from '../../../types';
13+
import { Flex } from '../Flex';
1314

1415
const styles = {
1516
form: (theme: typeof Theme) => css`
@@ -38,29 +39,23 @@ const styles = {
3839
`,
3940
commentsList: (theme: typeof Theme) => css`
4041
width: 100%;
41-
list-style-type: none;
4242
padding: 20px 0px;
4343
margin: 0px;
4444
border-radius: 3px;
4545
background: ${theme.bgDark};
4646
`,
47-
commentFirst: css`
48-
margin-top: 20px;
49-
`,
5047
comment: css`
51-
margin: 40px 20px 20px 20px;
52-
display: flex;
53-
justify-content: space-around;
48+
flex-grow: 1;
49+
margin: 1rem 1rem 1rem 1rem;
5450
`,
5551
commentHeader: css`
5652
flex-grow: 1;
57-
display: flex;
58-
flex-direction: column;
5953
min-width: 20%;
54+
margin-right: 1rem;
6055
`,
6156
commentAuthorName: (theme: typeof Theme) => css`
62-
margin-top: 20px;
63-
margin-bottom: 20px;
57+
margin-top: 0px;
58+
margin-bottom: 10px;
6459
color: ${theme.main};
6560
`,
6661
commentDate: (theme: typeof Theme) => css`
@@ -109,18 +104,18 @@ const CommentsSection = ({ issueId }: CommentsSectionProps) => {
109104

110105
return (
111106
<>
112-
<h2>Comments</h2>
113-
<ul css={styles.commentsList(theme)}>
114-
{journalEntries.map((entry, index) => (
115-
<li css={index === 0 ? [styles.comment, styles.commentFirst] : [styles.comment]} key={entry.id}>
116-
<div css={styles.commentHeader}>
117-
<h3 css={styles.commentAuthorName(theme)}>{entry.user.name}</h3>
107+
<h3>Comments</h3>
108+
<Flex alignItems="stretch" direction="column" css={styles.commentsList(theme)}>
109+
{journalEntries.map((entry) => (
110+
<Flex justifyContent="center" css={styles.comment} key={entry.id}>
111+
<Flex direction="column" css={styles.commentHeader}>
112+
<h4 css={styles.commentAuthorName(theme)}>{entry.user.name}</h4>
118113
<DateComponent className="date" date={entry.createdOn} />
119-
</div>
114+
</Flex>
120115
<MarkdownText css={styles.markdown(theme)} name={`comment-${entry.id}`} markdownText={entry.notes as string} />
121-
</li>
116+
</Flex>
122117
))}
123-
</ul>
118+
</Flex>
124119
<div css={styles.form(theme)}>
125120
<MarkdownEditor id="comments-form" name="comments-form" onSubmit={sendComments} />
126121
<div>

render/components/__tests__/MarkdownEditor.spec.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from '@testing-library/react';
55
import '@testing-library/jest-dom/extend-expect';
66
import { ThemeProvider } from 'styled-components';
7-
import MarkdownEditor, { MarkdownText } from '../MarkdownEditor';
7+
import { MarkdownText, MarkdownEditor } from '../MarkdownEditor';
88
import utils from '../../../main/utils';
99
import { theme } from '../../theme';
1010

render/reducers/__tests__/issue.selected.reducer.spec.js

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import _cloneDeep from 'lodash/cloneDeep';
22

33
import { notify } from '../../actions/helper';
44
import {
5-
ISSUES_COMMENTS_SEND,
65
ISSUES_TIME_ENTRY_GET
76
} from '../../actions/issues.actions';
87
import {
@@ -17,105 +16,6 @@ describe('Selected issue reducer', () => {
1716
expect(reducer(undefined, { type: 'WEIRD' })).toEqual(initialState);
1817
});
1918

20-
describe('ISSUES_COMMENTS_SEND', () => {
21-
it('status START', () => {
22-
expect(
23-
reducer(
24-
_cloneDeep(initialState),
25-
notify.start(ISSUES_COMMENTS_SEND, { subject: 'comments' })
26-
)
27-
).toEqual({
28-
..._cloneDeep(initialState),
29-
updates: {
30-
comments: {
31-
ok: false,
32-
isUpdating: true,
33-
error: undefined
34-
}
35-
}
36-
});
37-
});
38-
39-
it('status OK', () => {
40-
const data = {
41-
hello: 'world'
42-
};
43-
expect(
44-
reducer(
45-
{
46-
..._cloneDeep(initialState),
47-
data: {
48-
journals: ['hello', 'world']
49-
},
50-
updates: {
51-
something: {
52-
ok: true,
53-
isUpdating: false,
54-
error: undefined
55-
},
56-
comments: {
57-
ok: false,
58-
isUpdating: true,
59-
error: undefined
60-
}
61-
}
62-
},
63-
notify.ok(ISSUES_COMMENTS_SEND, data, { subject: 'comments' })
64-
)
65-
).toEqual({
66-
..._cloneDeep(initialState),
67-
data: {
68-
journals: ['hello', 'world', data]
69-
},
70-
updates: {
71-
something: {
72-
ok: true,
73-
isUpdating: false,
74-
error: undefined
75-
},
76-
comments: {
77-
ok: true,
78-
isUpdating: false,
79-
error: undefined
80-
}
81-
}
82-
});
83-
});
84-
85-
it('status NOK', () => {
86-
const error = new Error('Whoops');
87-
expect(
88-
reducer(
89-
{
90-
..._cloneDeep(initialState),
91-
updates: {
92-
something: {
93-
ok: true,
94-
isUpdating: false,
95-
error: undefined
96-
}
97-
}
98-
},
99-
notify.nok(ISSUES_COMMENTS_SEND, error, { subject: 'comments' })
100-
)
101-
).toEqual({
102-
..._cloneDeep(initialState),
103-
updates: {
104-
something: {
105-
ok: true,
106-
isUpdating: false,
107-
error: undefined
108-
},
109-
comments: {
110-
ok: false,
111-
isUpdating: false,
112-
error
113-
}
114-
}
115-
});
116-
});
117-
});
118-
11919
describe('ISSUES_TIME_ENTRY_GET', () => {
12020
it('status START', () => {
12121
const state = _cloneDeep(initialState);

0 commit comments

Comments
 (0)