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

[SIEM] [Case] Fix flexbox issue in Case View #59195

Merged
merged 2 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { ReactNode, useCallback, useMemo, useState } from 'react';
import { EuiFlexGroup } from '@elastic/eui';
import styled, { css } from 'styled-components';
import React, { useCallback, useMemo, useState } from 'react';
import * as i18n from '../case_view/translations';

import { Case } from '../../../../containers/case/types';
Expand All @@ -15,55 +13,12 @@ import { UserActionItem } from './user_action_item';
import { UserActionMarkdown } from './user_action_markdown';
import { AddComment } from '../add_comment';

export interface UserActionItem {
avatarName: string;
children?: ReactNode;
skipPanel?: boolean;
title?: ReactNode;
}

export interface UserActionTreeProps {
data: Case;
isLoadingDescription: boolean;
onUpdateField: (updateKey: keyof Case, updateValue: string | string[]) => void;
}

const UserAction = styled(EuiFlexGroup)`
${({ theme }) => css`
& {
background-image: linear-gradient(
to right,
transparent 0,
transparent 15px,
${theme.eui.euiBorderColor} 15px,
${theme.eui.euiBorderColor} 17px,
transparent 17px,
transparent 100%
);
background-repeat: no-repeat;
background-position: left ${theme.eui.euiSizeXXL};
margin-bottom: ${theme.eui.euiSizeS};
}
.userAction__panel {
margin-bottom: ${theme.eui.euiSize};
}
.userAction__circle {
flex-shrink: 0;
margin-right: ${theme.eui.euiSize};
vertical-align: top;
}
.userAction__title {
padding: ${theme.eui.euiSizeS} ${theme.eui.euiSizeL};
background: ${theme.eui.euiColorLightestShade};
border-bottom: ${theme.eui.euiBorderThin};
border-radius: ${theme.eui.euiBorderRadius} ${theme.eui.euiBorderRadius} 0 0;
}
.euiText--small * {
margin-bottom: 0;
}
`}
`;

const DescriptionId = 'description';
const NewId = 'newComent';

Expand Down Expand Up @@ -113,7 +68,7 @@ export const UserActionTree = React.memo(
const MarkdownNewComment = useMemo(() => <AddComment caseId={data.caseId} />, [data.caseId]);

return (
<UserAction data-test-subj="user-action-description" gutterSize={'none'}>
<>
<UserActionItem
createdAt={data.createdAt}
id={DescriptionId}
Expand Down Expand Up @@ -159,7 +114,7 @@ export const UserActionTree = React.memo(
onEdit={handleManageMarkdownEditId.bind(null, NewId)}
userName="to be determined"
/>
</UserAction>
</>
);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexItem, EuiPanel } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui';
import React from 'react';

import styled, { css } from 'styled-components';
import { UserActionAvatar } from './user_action_avatar';
import { UserActionTitle } from './user_action_title';

Expand All @@ -23,6 +24,42 @@ interface UserActionItemProps {
userName: string;
}

const UserAction = styled(EuiFlexGroup)`
stephmilovic marked this conversation as resolved.
Show resolved Hide resolved
${({ theme }) => css`
& {
background-image: linear-gradient(
to right,
transparent 0,
transparent 15px,
${theme.eui.euiBorderColor} 15px,
${theme.eui.euiBorderColor} 17px,
transparent 17px,
transparent 100%
);
background-repeat: no-repeat;
background-position: left ${theme.eui.euiSizeXXL};
margin-bottom: ${theme.eui.euiSizeS};
}
.userAction__panel {
margin-bottom: ${theme.eui.euiSize};
}
.userAction__circle {
flex-shrink: 0;
margin-right: ${theme.eui.euiSize};
vertical-align: top;
}
.userAction__title {
padding: ${theme.eui.euiSizeS} ${theme.eui.euiSizeL};
background: ${theme.eui.euiColorLightestShade};
border-bottom: ${theme.eui.euiBorderThin};
border-radius: ${theme.eui.euiBorderRadius} ${theme.eui.euiBorderRadius} 0 0;
}
.euiText--small * {
margin-bottom: 0;
}
`}
`;

export const UserActionItem = ({
createdAt,
id,
Expand All @@ -35,7 +72,7 @@ export const UserActionItem = ({
onEdit,
userName,
}: UserActionItemProps) => (
<>
<UserAction gutterSize={'none'}>
<EuiFlexItem data-test-subj={`user-action-${id}-avatar`} grow={false}>
<UserActionAvatar name={fullName ?? userName} />
</EuiFlexItem>
Expand All @@ -56,5 +93,5 @@ export const UserActionItem = ({
</EuiPanel>
)}
</EuiFlexItem>
</>
</UserAction>
);