Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EuiComment #3179

Merged
merged 27 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f83761b
playing with css and layouts
andreadelrio Mar 5, 2020
cb9a8d5
more experimentation with styles
andreadelrio Mar 9, 2020
e8c77e6
before adding an extra style to commentEvent
andreadelrio Mar 11, 2020
61dad2f
some things I stashed, not sure why
andreadelrio Mar 16, 2020
508211e
will try a different way for separator
andreadelrio Mar 20, 2020
193a22b
rename one prop and improve handling of large timelineIcon
andreadelrio Mar 23, 2020
40f046b
props descriptions not showing up
andreadelrio Mar 24, 2020
0f088f9
improve demo
andreadelrio Mar 25, 2020
4776ea4
clean and more tests
andreadelrio Mar 25, 2020
9e2a095
mobile small improvement
andreadelrio Mar 26, 2020
58fc8f9
add snippet
andreadelrio Mar 26, 2020
1fa8a6e
Merge branch 'master' into comment
thompsongl Mar 26, 2020
e5b1d1c
add cl
andreadelrio Mar 26, 2020
c691624
feedback part 1
andreadelrio Mar 31, 2020
89f1fef
feedback part 2
andreadelrio Apr 2, 2020
c4fbca4
remove commentList for now
andreadelrio Apr 2, 2020
ea74210
header in regular has min-height and fixed separator in mobile
andreadelrio Apr 2, 2020
56855b3
documentation feedback
andreadelrio Apr 3, 2020
91eb5fb
more feedback and new tests
andreadelrio Apr 6, 2020
6cb33b1
more tests and more IE fixes
andreadelrio Apr 6, 2020
0e831b0
Tidying CSS a bit and fixing IE and responsiveness
Apr 6, 2020
12eb136
Merge pull request #8 from cchaos/andreadelrio-comment
andreadelrio Apr 6, 2020
c96b3cc
greg's feedback
andreadelrio Apr 7, 2020
da73824
small a11y change
andreadelrio Apr 7, 2020
c986405
figure; better type inheritance
thompsongl Apr 8, 2020
a2be805
Merge remote-tracking branch 'upstream/master' into comment
andreadelrio Apr 8, 2020
d6cf389
update cl
andreadelrio Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Improved `EuiModal` close button position to prevent from overlapping with the title ([#3176](https://github.com/elastic/eui/pull/3176))
- Added `EuiComment` component ([#3179](https://github.com/elastic/eui/pull/3179))

**Bug Fixes**

Expand Down
3 changes: 3 additions & 0 deletions src-docs/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import { ColorPickerExample } from './views/color_picker/color_picker_example';

import { ComboBoxExample } from './views/combo_box/combo_box_example';

import { CommentExample } from './views/comment/comment_example';

import { ContextMenuExample } from './views/context_menu/context_menu_example';

import { ControlBarExample } from './views/control_bar/control_bar_example';
Expand Down Expand Up @@ -353,6 +355,7 @@ const navigation = [
CallOutExample,
CardExample,
CodeExample,
CommentExample,
DescriptionListExample,
DragAndDropExample,
EmptyPromptExample,
Expand Down
95 changes: 95 additions & 0 deletions src-docs/src/views/comment/comment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from 'react';
import { EuiComment } from '../../../../src/components/comment';
import { EuiIcon } from '../../../../src/components/icon';
import { EuiAvatar } from '../../../../src/components/avatar';
import { EuiBadge } from '../../../../src/components/badge';
import { EuiFlexGroup, EuiFlexItem } from '../../../../src/components/flex';
import { EuiButtonIcon } from '../../../../src/components/button';

const body =
'Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun.';

const longBody =
'This planet has - or rather had - a problem, which was this: most of the people living on it were unhappy for pretty much of the time. Many solutions were suggested for this problem, but most of these were largely concerned with the movements of small green pieces of paper, which is odd because on the whole it was not the small green pieces of paper that were unhappy.';
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved

const bodyUpdate = 'This type of comment can also have a body';

const copyAction = <EuiButtonIcon color="subdued" iconType="copy" />;
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved

export default () => (
<div>
<EuiComment
username="janed"
event="added a comment"
actions={copyAction}
timestamp="on Jan 1, 2020">
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
{body}
</EuiComment>
<EuiComment
username="juanab"
type="update"
actions={copyAction}
event="pushed incident X0Z235"
timestamp="on Jan 3, 2020"
timelineIcon={
<EuiAvatar
imageUrl="https://source.unsplash.com/64x64/?woman"
size="l"
name="Juana"
/>
}
/>
<EuiComment
actions={copyAction}
username={
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiAvatar size="s" type="space" name="Pedro" />
</EuiFlexItem>
<EuiFlexItem grow={false}>pedror</EuiFlexItem>
</EuiFlexGroup>
}
type="update"
event={
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>added tags</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="primary">sample</EuiBadge>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="secondary">review</EuiBadge>
</EuiFlexItem>
</EuiFlexGroup>
}
timestamp="on Jan 4, 2020"
timelineIcon={
<div className="euiCommentTimeline__contentDefault">
<EuiIcon size="l" type="tag" />
</div>
}
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
/>
<EuiComment
username="pancho1"
type="update"
event="edited case"
timestamp="on Jan 11, 2020"
timelineIcon={<EuiAvatar size="l" name="Pancho" />}
/>
<EuiComment
username="elohar"
event="added a comment"
actions={copyAction}
timestamp="on Jan 14, 2020"
timelineIcon={<EuiAvatar size="l" name="Eloha" />}>
{longBody}
</EuiComment>
<EuiComment
username="pancho1"
type="update"
event="edited case"
timestamp="on Jan 21, 2020"
timelineIcon={<EuiAvatar size="l" name="Pancho" />}>
{bodyUpdate}
</EuiComment>
</div>
);
59 changes: 59 additions & 0 deletions src-docs/src/views/comment/comment_example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved

import { renderToHtml } from '../../services';

import { GuideSectionTypes } from '../../components';

import { EuiCode, EuiComment } from '../../../../src/components';

import Comment from './comment';
const commentSource = require('!!raw-loader!./comment');
const commentHtml = renderToHtml(Comment);

const commentSnippet = `<EuiComment username="janed">
{body}
</EuiComment>`;

export const CommentExample = {
title: 'Comment',
sections: [
{
source: [
{
type: GuideSectionTypes.JS,
code: commentSource,
},
{
type: GuideSectionTypes.HTML,
code: commentHtml,
},
],
text: (
<div>
<p>
Use <EuiCode>EuiComment</EuiCode> for displaying comment threads
with <EuiCode>EuiCommentList</EuiCode>. There are two different
types of comments <EuiCode>regular</EuiCode> and{' '}
<EuiCode>update</EuiCode> available through the{' '}
<EuiCode>type</EuiCode> prop. Use comments of type{' '}
<EuiCode>update</EuiCode> to display comments that generally do not
have a body and are logging actions that either the user or the
system has performed (e.g. &ldquo;jsmith edited a case&rdquo; or
&ldquo;kibanamachine added the backport missing label&rdquo;).
</p>
<p>
The <EuiCode>timelineIcon</EuiCode> can be customized as needed. It
is recommended to use an element of dimensions 40x40. The default{' '}
<EuiCode>timelineIcon</EuiCode> is a user icon.
</p>
<p>
Use <EuiCode>children</EuiCode> to pass the body of the comment.
</p>
</div>
),
props: { EuiComment },
snippet: commentSnippet,
demo: <Comment />,
},
],
};
Loading