+ Use EuiTimeline to display a list of{' '}
+ EuiTimelines. Pass an array of{' '}
+ EuiTimeline objects and EuiTimeline{' '}
+ will generate a timeline thread.
+
+);
diff --git a/src/components/avatar/__snapshots__/avatar.test.tsx.snap b/src/components/avatar/__snapshots__/avatar.test.tsx.snap
index 1559166b8fa..71fed329935 100644
--- a/src/components/avatar/__snapshots__/avatar.test.tsx.snap
+++ b/src/components/avatar/__snapshots__/avatar.test.tsx.snap
@@ -64,6 +64,21 @@ exports[`EuiAvatar props color as plain is rendered 1`] = `
`;
+exports[`EuiAvatar props color as shade is rendered 1`] = `
+
+
+ n
+
+
+`;
+
exports[`EuiAvatar props color as string is rendered 1`] = `
{
expect(component).toMatchSnapshot();
});
+
+ it('as shade is rendered', () => {
+ const component = render();
+
+ expect(component).toMatchSnapshot();
+ });
});
describe('isDisabled', () => {
diff --git a/src/components/avatar/avatar.tsx b/src/components/avatar/avatar.tsx
index e526f626759..75abe838c38 100644
--- a/src/components/avatar/avatar.tsx
+++ b/src/components/avatar/avatar.tsx
@@ -84,9 +84,9 @@ export type EuiAvatarProps = Omit, 'color'> &
/**
* Accepts hex values like `#FFFFFF`, `#000` otherwise a viz palette color will be assigned.
- * Or pass `'plain'` for an empty shade or `null` to remove entirely and the text/icon color will `inherit`
+ * Or pass `'plain'` for an empty shade, `'shade'` for an light shade or `null` to remove entirely and the text/icon color will `inherit`
*/
- color?: string | 'plain' | null;
+ color?: string | 'plain' | 'shade' | null;
/**
* The type of avatar mainly controlling the shape.
@@ -127,6 +127,7 @@ export const EuiAvatar: FunctionComponent = ({
{
'euiAvatar-isDisabled': isDisabled,
'euiAvatar--plain': color === 'plain',
+ 'euiAvatar--shade': color === 'shade',
},
className
);
@@ -136,7 +137,7 @@ export const EuiAvatar: FunctionComponent = ({
const avatarStyle: CSSProperties = style || {};
let iconCustomColor = iconColor;
- const isNamedColor = color === 'plain' || color === null;
+ const isNamedColor = color === 'plain' || color === 'shade' || color === null;
if (!isNamedColor) {
checkValidColor(color);
@@ -191,7 +192,8 @@ export const EuiAvatar: FunctionComponent = ({
// TODO: Migrate to a service
export const checkValidColor = (color: EuiAvatarProps['color']) => {
- const validHex = (color && isValidHex(color)) || color === 'plain';
+ const validHex =
+ (color && isValidHex(color)) || color === 'plain' || color === 'shade';
if (color && !validHex) {
throw new Error(
'EuiAvatar needs to pass a valid color. This can either be a three ' +
diff --git a/src/components/index.scss b/src/components/index.scss
index a42e85b124e..0d26b622c2e 100644
--- a/src/components/index.scss
+++ b/src/components/index.scss
@@ -62,6 +62,7 @@
@import 'table/index';
@import 'tabs/index';
@import 'text_diff/index';
+@import 'timeline/index';
@import 'title/index';
@import 'toast/index';
@import 'token/index';
diff --git a/src/components/index.ts b/src/components/index.ts
index 54167a1415a..b689a113de5 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -161,6 +161,8 @@ export * from './text';
export * from './text_diff';
+export * from './timeline';
+
export * from './title';
export * from './toast';
diff --git a/src/components/timeline/_index.scss b/src/components/timeline/_index.scss
new file mode 100644
index 00000000000..82bd7da27a8
--- /dev/null
+++ b/src/components/timeline/_index.scss
@@ -0,0 +1,4 @@
+@import 'timeline_item';
+@import 'timeline_item_event';
+@import 'timeline_item_icon';
+@import 'timeline_item_panel';
\ No newline at end of file
diff --git a/src/components/timeline/_timeline_item.scss b/src/components/timeline/_timeline_item.scss
new file mode 100644
index 00000000000..2b361aebbf2
--- /dev/null
+++ b/src/components/timeline/_timeline_item.scss
@@ -0,0 +1,34 @@
+.euiTimelineItem {
+ font-size: $euiFontSizeS;
+ display: flex;
+ padding-bottom: $euiSize;
+ min-height: $euiSize * 3.5;
+
+ .euiTimelineItemEvent {
+ flex-grow: 1;
+ }
+
+ .euiTimelineItemIcon {
+ position: relative;
+ flex-grow: 0;
+ margin-right: $euiSize;
+
+ &::before {
+ content: '';
+ position: absolute;
+ left: $euiSizeXXL / 2;
+ top: $euiSize;
+ width: $euiSizeXS / 2;
+ background-color: $euiColorLightShade;
+ height: calc(100% + #{$euiSize});
+ }
+ }
+}
+
+.euiTimelineItem:last-of-type {
+ .euiTimelineItemIcon {
+ &::before {
+ display: none;
+ }
+ }
+}
diff --git a/src/components/timeline/_timeline_item_event.scss b/src/components/timeline/_timeline_item_event.scss
new file mode 100644
index 00000000000..a31445da8c5
--- /dev/null
+++ b/src/components/timeline/_timeline_item_event.scss
@@ -0,0 +1,3 @@
+.euiTimelineItemEvent {
+ overflow: hidden;
+}
diff --git a/src/components/timeline/_timeline_item_icon.scss b/src/components/timeline/_timeline_item_icon.scss
new file mode 100644
index 00000000000..c2440f45ddb
--- /dev/null
+++ b/src/components/timeline/_timeline_item_icon.scss
@@ -0,0 +1,18 @@
+.euiTimelineItemIcon__content {
+ min-width: $euiSizeXXL;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ position: relative;
+}
+
+.euiTimelineItemIcon__iconBackground {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ overflow-x: hidden;
+ border-radius: 50%;
+ background-color: $euiColorLightestShade;
+ width: $euiSizeXL;
+ height: $euiSizeXL;
+}
\ No newline at end of file
diff --git a/src/components/timeline/_timeline_item_panel.scss b/src/components/timeline/_timeline_item_panel.scss
new file mode 100644
index 00000000000..15bb95ea1ca
--- /dev/null
+++ b/src/components/timeline/_timeline_item_panel.scss
@@ -0,0 +1,3 @@
+.euiTimelineItemPanel__header {
+ border-bottom: $euiBorderThin;
+}
diff --git a/src/components/timeline/index.ts b/src/components/timeline/index.ts
new file mode 100644
index 00000000000..b7a2bc0d0ba
--- /dev/null
+++ b/src/components/timeline/index.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type { EuiTimelineItemProps } from './timeline_item';
+export { EuiTimelineItem } from './timeline_item';
+
+export { EuiTimelineItemEvent } from './timeline_item_event';
+
+export { EuiTimelineItemIcon } from './timeline_item_icon';
+
+export { EuiTimelineItemPanel } from './timeline_item_panel';
+
+export type { EuiTimelineProps } from './timeline';
+export { EuiTimeline } from './timeline';
diff --git a/src/components/timeline/timeline.tsx b/src/components/timeline/timeline.tsx
new file mode 100644
index 00000000000..6e1e14f98d9
--- /dev/null
+++ b/src/components/timeline/timeline.tsx
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React, { HTMLAttributes, FunctionComponent } from 'react';
+import { CommonProps } from '../common';
+import classNames from 'classnames';
+import { EuiTimelineItem, EuiTimelineItemProps } from './timeline_item';
+
+export type EuiTimelineProps = HTMLAttributes &
+ CommonProps & {
+ /**
+ * List of timelines to render. See #EuiTimeline
+ */
+ items?: EuiTimelineItemProps[];
+ };
+
+export const EuiTimeline: FunctionComponent = ({
+ className,
+ items,
+ ...rest
+}) => {
+ const classes = classNames('euiTimeline', className);
+
+ let timelineElements = null;
+
+ if (items) {
+ timelineElements = items.map((item, index) => (
+
+ ));
+ }
+
+ return (
+
+ {timelineElements}
+
+ );
+};
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
new file mode 100644
index 00000000000..0048638483a
--- /dev/null
+++ b/src/components/timeline/timeline_item.tsx
@@ -0,0 +1,43 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React, { FunctionComponent, HTMLAttributes } from 'react';
+import classNames from 'classnames';
+import { keysOf } from '../common';
+import { EuiTimelineItemEvent } from './timeline_item_event';
+import {
+ EuiTimelineItemIcon,
+ EuiTimelineItemIconProps,
+} from './timeline_item_icon';
+
+export type EuiTimelineItemProps = HTMLAttributes &
+ EuiTimelineItemIconProps;
+
+const typeToClassNameMap = {
+ regular: '',
+ update: 'euiTimeline--update',
+ custom: '',
+};
+
+export const TYPES = keysOf(typeToClassNameMap);
+
+export const EuiTimelineItem: FunctionComponent = ({
+ children,
+ className,
+ icon,
+ ...rest
+}) => {
+ const classes = classNames('euiTimelineItem', className);
+
+ return (
+
+
+ {children}
+
+ );
+};
diff --git a/src/components/timeline/timeline_item_event.tsx b/src/components/timeline/timeline_item_event.tsx
new file mode 100644
index 00000000000..fe9e7762a80
--- /dev/null
+++ b/src/components/timeline/timeline_item_event.tsx
@@ -0,0 +1,21 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React, { FunctionComponent } from 'react';
+import { CommonProps } from '../common';
+import classNames from 'classnames';
+export interface EuiTimelineItemEventProps extends CommonProps {}
+
+export const EuiTimelineItemEvent: FunctionComponent = ({
+ children,
+ className,
+}) => {
+ const classes = classNames('euiTimelineItemEvent', className);
+
+ return
{children}
;
+};
diff --git a/src/components/timeline/timeline_item_icon.tsx b/src/components/timeline/timeline_item_icon.tsx
new file mode 100644
index 00000000000..b4669dd57ae
--- /dev/null
+++ b/src/components/timeline/timeline_item_icon.tsx
@@ -0,0 +1,38 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React, { FunctionComponent, ReactNode } from 'react';
+import classNames from 'classnames';
+import { CommonProps } from '../common';
+import { EuiIcon, IconType } from '../icon';
+
+export interface EuiTimelineItemIconProps extends CommonProps {
+ /**
+ * Main icon. To customize, pass a `string` as an `EuiIcon['type']` or any `ReactNode`.
+ */
+ icon?: ReactNode | IconType;
+}
+
+export const EuiTimelineItemIcon: FunctionComponent = ({
+ icon,
+ className,
+}) => {
+ const iconRender = typeof icon === 'string' ? : icon;
+ const classes = classNames('euiTimelineItemIcon', className);
+ const iconClasses = classNames({
+ euiTimelineItemIcon__iconBackground: typeof icon === 'string',
+ });
+
+ return (
+
+ Move data to the cold tier when you are searching it less often and
+ don’t need to update it. The cold tier is optimized for cost savings
+ over search performance.
+
+ Store your most recent, most frequently-searched data in the hot
+ tier. The hot tier provides the best indexing and search performance
+ by using the most powerful, expensive hardware.
+
- Use EuiTimeline to display a list of{' '}
- EuiTimelines. Pass an array of{' '}
- EuiTimeline objects and EuiTimeline{' '}
- will generate a timeline thread.
+ The EuiTimeline component is somehow an opinionated
+ component that standardizes the way a timeline thread is displayed.
+ But it gives the ability to add custom components and icons. Pass an
+ array of EuiTimelineItem objects and{' '}
+ EuiTimeline will generate a timeline thread.
- Use EuiTimeline to display timelines. Each{' '}
- EuiTimeline has two parts: a{' '}
- timelineIcon on the left and content on the
- right.
+ Use EuiTimelineItemto display timeline items. Each
+ EuiTimelineItem accepts two props: iconicon and{' '}
+ children. For the children, we recommend the
+ usage of a{' '}
+
+ EuiPanel
+ {' '}
+ with hasBorder set to true or with color{' '}
+ {'"transparent"'}. Try to avoid passing the color{' '}
+ {'"plain"'}. This color adds a shadow that is not
+ suitable for this component.
- Use EuiTimeline to display timelines. Each{' '}
- EuiTimeline has two parts: a{' '}
- timelineIcon on the left and content on the
- right.
+ The EuiTimelineItemPanel is an opinionated
+ component whose purpose is to display a panel that can have a header
+ and body. It's built on top of the{' '}
+
+ EuiPanel
+ {' '}
+ and it's the perfect building block to create any type os
+ timelines.
- Use EuiTimelineItemto display timeline items. Each
- EuiTimelineItem accepts two props: iconicon and{' '}
- children. For the children, we recommend the
- usage of a{' '}
+ Use EuiTimelineItem to display timeline items. Each{' '}
+ EuiTimelineItem accepts two props:{' '}
+ icon and children. For the{' '}
+ children, we recommend the usage of a{' '}
+ EuiTimelineItemPanel but you can use any other
+ component. If you use a{' '}
EuiPanel
- {' '}
- with hasBorder set to true or with color{' '}
- {'"transparent"'}. Try to avoid passing the color{' '}
- {'"plain"'}. This color adds a shadow that is not
- suitable for this component.
+
+ , try to avoid passing the color {'"plain"'}.
+ This color adds a shadow that is not suitable for this component.
),
@@ -104,12 +104,12 @@ export const TimelineExample = {
EuiPanel
{' '}
- and it's the perfect building block to create any type os
- timelines.
+ and it's the recommended component to use in{' '}
+ EuiTimelineItem.children.
),
- props: { EuiTimeline },
+ props: { EuiTimelineItemPanel },
snippet: timelineItemPanelSnippet,
demo: ,
},
@@ -130,7 +130,7 @@ export const TimelineExample = {
),
- props: { EuiTimelineItemPanel },
+ props: { EuiTimeline, EuiTimelineItem, EuiTimelineItemPanel },
demo: ,
},
],
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
index 0048638483a..1b3c9460318 100644
--- a/src/components/timeline/timeline_item.tsx
+++ b/src/components/timeline/timeline_item.tsx
@@ -8,7 +8,6 @@
import React, { FunctionComponent, HTMLAttributes } from 'react';
import classNames from 'classnames';
-import { keysOf } from '../common';
import { EuiTimelineItemEvent } from './timeline_item_event';
import {
EuiTimelineItemIcon,
@@ -18,14 +17,6 @@ import {
export type EuiTimelineItemProps = HTMLAttributes &
EuiTimelineItemIconProps;
-const typeToClassNameMap = {
- regular: '',
- update: 'euiTimeline--update',
- custom: '',
-};
-
-export const TYPES = keysOf(typeToClassNameMap);
-
export const EuiTimelineItem: FunctionComponent = ({
children,
className,
diff --git a/src/components/timeline/timeline_item_panel.tsx b/src/components/timeline/timeline_item_panel.tsx
index 2f8f5d29dd1..b3cac2a6d32 100644
--- a/src/components/timeline/timeline_item_panel.tsx
+++ b/src/components/timeline/timeline_item_panel.tsx
@@ -28,7 +28,7 @@ export type EuiTimelineItemPanelProps = {
color?: _EuiPanelDivlike['color'];
headerColor?: _EuiPanelDivlike['color'];
/**
- * Adds a border around the panel. When a `header` is passed adds a border separating the header and body.
+ * Adds a border around the panel and a line separating the header and body.
*/
hasBorder?: _EuiPanelDivlike['hasBorder'];
/**
From 8ef5d799940d633ffd2e2bf49cfffc5ac06d278c Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Fri, 18 Mar 2022 11:47:42 +0000
Subject: [PATCH 04/59] WIP
---
src-docs/src/views/timeline/timeline_complex.tsx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src-docs/src/views/timeline/timeline_complex.tsx b/src-docs/src/views/timeline/timeline_complex.tsx
index ce26f89e3f1..f87c94031f5 100644
--- a/src-docs/src/views/timeline/timeline_complex.tsx
+++ b/src-docs/src/views/timeline/timeline_complex.tsx
@@ -118,11 +118,13 @@ export default () => {
}
>
-
- Store your most recent, most frequently-searched data in the hot
- tier. The hot tier provides the best indexing and search performance
- by using the most powerful, expensive hardware.
-
+
+
+ Store your most recent, most frequently-searched data in the hot
+ tier. The hot tier provides the best indexing and search
+ performance by using the most powerful, expensive hardware.
+
- Move data to the cold tier when you are searching it less often and
- don’t need to update it. The cold tier is optimized for cost savings
- over search performance.
-
+ Move data to the cold tier when you are searching it less often
+ and don’t need to update it. The cold tier is optimized for cost
+ savings over search performance.
+
Store your most recent, most frequently-searched data in the hot
tier. The hot tier provides the best indexing and search
performance by using the most powerful, expensive hardware.
- The EuiTimeline component is somehow an opinionated
- component that standardizes the way a timeline thread is displayed.
- But it gives the ability to add custom components and icons. Pass an
- array of EuiTimelineItem objects and{' '}
+ The EuiTimeline is a component that standardizes the
+ way a timeline thread is displayed. But it gives the ability to add
+ custom components and icons. Pass an array of{' '}
+ EuiTimelineItem objects and{' '}
EuiTimeline will generate a timeline thread.
Use EuiTimelineItem to display timeline items. Each{' '}
- EuiTimelineItem accepts two props:{' '}
- icon and children. For the{' '}
- children, we recommend the usage of a{' '}
- EuiTimelineItemPanel but you can use any other
- component. If you use a{' '}
-
- EuiPanel
-
- , try to avoid passing the color {'"plain"'}.
- This color adds a shadow that is not suitable for this component.
+ EuiTimelineItem accepts two parts:{' '}
+ icon on the left side and an{' '}
+ event on the right side.
- The EuiTimelineItemPanel is an opinionated
- component whose purpose is to display a panel that can have a header
- and body. It's built on top of the{' '}
+ An event is built on top of the{' '}
EuiPanel
{' '}
- and it's the recommended component to use in{' '}
- EuiTimelineItem.children.
+ and it's made of a header and a body. To create an event you
+ just need to use the following props:
+
+
+ eventHeader: the most important part of the
+ event (e.g. a title, username, metadata).
+
+
+ eventBody: additional content. You can also use
+ this prop to pass more complex components like editors, code
+ blocks or any custom component.
+
+
+ eventProps: additional props to customize the
+ event panel. You can change the color, header color, and adjust
+ the padding.
+
- This is an example of how to combine multiple{' '}
- EuiTimelineItem with{' '}
- EuiTimelinePanel.
+ This is an example of how you can customize and display multiple{' '}
+ EuiTimelineItem.
- An event is built on top of the{' '}
+ An event is basically the right side of the{' '}
+ EuiTimelineItem and it's built on top of the{' '}
- EuiPanel
+ EuiPanel.
{' '}
- and it's made of a header and a body. To create an event you
- just need to use the following props:
+ Each event can have a eventHeader, a{' '}
+ eventBody and eventProps:
eventHeader: the most important part of the
- event (e.g. a title, username, metadata).
+ event (e.g. a title, username, metadata). All the content should
+ be in one line. When no body is present the header vertically
+ center aligns with the left side icon.
eventBody: additional content. You can also use
- this prop to pass more complex components like editors, code
- blocks or any custom component.
+ this prop to pass more complex components (e.g. editors, code
+ blocks or any custom component).
eventProps: additional props to customize the
diff --git a/src-docs/src/views/timeline/timeline_item.tsx b/src-docs/src/views/timeline/timeline_item.tsx
index eb47aff0535..37dc2796894 100644
--- a/src-docs/src/views/timeline/timeline_item.tsx
+++ b/src-docs/src/views/timeline/timeline_item.tsx
@@ -1,15 +1,10 @@
import React from 'react';
-import {
- EuiTimelineItem,
- EuiText,
- EuiBadge,
- EuiTextArea,
-} from '../../../../src/components';
+import { EuiTimelineItem, EuiText, EuiBadge } from '../../../../src/components';
export default () => (
@@ -18,17 +13,19 @@ export default () => (
}
- />
-
- {}}
- />
+
+
+ The icon is on the left side and I'm an{' '}
+ eventBody
+
);
diff --git a/src/components/timeline/_timeline_item.scss b/src/components/timeline/_timeline_item.scss
index 7b289579a1e..3ddf1c7ca83 100644
--- a/src/components/timeline/_timeline_item.scss
+++ b/src/components/timeline/_timeline_item.scss
@@ -25,7 +25,7 @@
}
}
-.euiTimelineItem--update:not(.euiTimelineItem--hasBody) {
+.euiTimelineItem--hasHeader:not(.euiTimelineItem--hasBody) {
align-items: center;
}
diff --git a/src/components/timeline/_timeline_item_event.scss b/src/components/timeline/_timeline_item_event.scss
index 64a40820c6a..36bcd0eb52c 100644
--- a/src/components/timeline/_timeline_item_event.scss
+++ b/src/components/timeline/_timeline_item_event.scss
@@ -5,6 +5,10 @@
overflow: hidden;
}
+.euiTimelineItemEvent__inner {
+ flex: 1;
+}
+
.euiTimelineItemEvent__header {
border-radius: $euiBorderRadius $euiBorderRadius 0 0;
}
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
index 2df3c6b631c..4a3a4cd3d99 100644
--- a/src/components/timeline/timeline_item.tsx
+++ b/src/components/timeline/timeline_item.tsx
@@ -20,7 +20,7 @@ import {
export type EuiTimelineItemProps = HTMLAttributes & {
eventHeader?: EuiTimelineItemEventProps['header'];
eventBody?: EuiTimelineItemEventProps['body'];
- eventProps?: EuiTimelineItemEventProps;
+ eventProps?: Omit;
} & EuiTimelineItemIconProps;
export const EuiTimelineItem: FunctionComponent = ({
@@ -34,7 +34,7 @@ export const EuiTimelineItem: FunctionComponent = ({
}) => {
const classes = classNames(
'euiTimelineItem',
- { 'euiTimelineItem--update': eventHeader },
+ { 'euiTimelineItem--hasHeader': eventHeader },
{ 'euiTimelineItem--hasBody': eventBody },
className
);
diff --git a/src/components/timeline/timeline_item_event.tsx b/src/components/timeline/timeline_item_event.tsx
index 586c804db31..10d18ea3feb 100644
--- a/src/components/timeline/timeline_item_event.tsx
+++ b/src/components/timeline/timeline_item_event.tsx
@@ -24,26 +24,35 @@ export type PaddingSize = typeof PADDING_SIZES[number];
export type EuiTimelineItemEventProps = {
/**
- * The most important part of the event. Normally where tags in metadata should live.
+ * The most important part of the event (e.g. a title, username, metadata).
+ * It should be one line. When no body is passed it vertically center aligns with the icon.
*/
header?: ReactNode;
/**
- * Use the body for aditional content.
+ * Use the body for aditional content. You can also use this prop
+ * to pass more complex components (e.g. editors, code blocks or any custom component).
*/
body?: ReactNode;
+ /**
+ * Padding applied around the event header and/or event body.
+ */
paddingSize?: PaddingSize;
/**
- * Sets the color of the panel
+ * Sets the color of all the panel.
*/
color?: _EuiPanelDivlike['color'];
/**
- * Sets the color of the header color
+ * Sets the color of the header color.
*/
headerColor?: _EuiPanelDivlike['color'];
/**
* Adds a border around the panel and a line separating the header and body.
*/
hasBorder?: _EuiPanelDivlike['hasBorder'];
+ /**
+ * Changes the event wrapper element to `figure` and the the header element to `figcaption`.
+ */
+ isFigure?: boolean;
} & CommonProps &
Omit<
_EuiPanelDivlike,
@@ -60,6 +69,7 @@ export const EuiTimelineItemEvent: FunctionComponent
headerColor = 'transparent',
hasBorder,
grow = true,
+ isFigure = false,
...rest
}) => {
const classes = classNames(
@@ -75,19 +85,25 @@ export const EuiTimelineItemEvent: FunctionComponent
const bodyClasses = classNames('euiTimelineItemEvent__body');
+ const Element = isFigure ? 'figure' : 'div';
+ const HeaderElement = isFigure ? 'figcaption' : 'div';
+
return (
-
Store your most recent, most frequently-searched data in the hot
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index a711f526578..ed8f1f266c9 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -67,21 +67,38 @@ export const TimelineExample = {
},
],
text: (
-
+ <>
Use EuiTimelineItem to display timeline items. Each{' '}
- EuiTimelineItem accepts two parts:{' '}
- icon on the left side and an{' '}
- event on the right side.
+ EuiTimelineItem has two parts: an icon on the left
+ side and an event on the right side. To create an item you basically
+ need the following props:
-
+
+
+ icon: main icon that appears on the left side.
+
+
+ header: the most important part of an event
+ (e.g. a title, username, metadata). All the content should be in
+ one line. When no body is present the{' '}
+ header
+ vertically center aligns with the left side icon.
+
+
+ body: additional event content. You can also
+ use this prop to pass more complex components (e.g. editors, code
+ blocks or any custom component).
+
An event is basically the right side of the{' '}
EuiTimelineItem and it's built on top of the{' '}
- EuiPanel.
- {' '}
- Each event can have a eventHeader, a{' '}
- eventBody and eventProps:
+ EuiPanel
+
+ . This example demonstrates how you can use multiple panel props to
+ customize an event (e.g change the panelColor).
-
-
- eventHeader: the most important part of the
- event (e.g. a title, username, metadata). All the content should
- be in one line. When no body is present the header vertically
- center aligns with the left side icon.
-
-
- eventBody: additional content. You can also use
- this prop to pass more complex components (e.g. editors, code
- blocks or any custom component).
-
-
- eventProps: additional props to customize the
- event panel. You can change the color, header color, and adjust
- the padding.
-
header: the most important part of an event
- (e.g. a title, username, metadata). All the content should be in
- one line. When no body is present the{' '}
- header
- vertically center aligns with the left side icon.
+ (e.g. a title, username, metadata). The content should be in one
+ line. When no body is passed it vertically
+ center aligns with the icon.
body: additional event content. You can also
diff --git a/src/components/timeline/timeline_item_event.tsx b/src/components/timeline/timeline_item_event.tsx
index 08f4c9a4485..55a06452a41 100644
--- a/src/components/timeline/timeline_item_event.tsx
+++ b/src/components/timeline/timeline_item_event.tsx
@@ -48,7 +48,7 @@ export type EuiTimelineItemEventPanelProps = {
export type EuiTimelineItemEventProps = {
/**
* The most important part of the event (e.g. a title, username, metadata).
- * It should be one line. When no body is passed it vertically center aligns with the icon.
+ * The content should be in one line. When no body is passed it vertically center aligns with the icon.
*/
header?: ReactNode;
/**
From 6867384e211734344191798e78cc5b2de5148bbc Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Tue, 22 Mar 2022 13:09:08 +0000
Subject: [PATCH 12/59] Fixing rest props
---
src/components/timeline/_timeline_item_event.scss | 2 +-
src/components/timeline/timeline_item.tsx | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/components/timeline/_timeline_item_event.scss b/src/components/timeline/_timeline_item_event.scss
index 36bcd0eb52c..9e3293fe18b 100644
--- a/src/components/timeline/_timeline_item_event.scss
+++ b/src/components/timeline/_timeline_item_event.scss
@@ -18,7 +18,7 @@
}
.euiPanel--hasBorder {
- > .euiTimelineItemEvent__header {
+ > .euiTimelineItemEvent__inner .euiTimelineItemEvent__header {
border-bottom: $euiBorderThin;
}
}
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
index 656bb6a174b..3d0b6e3e216 100644
--- a/src/components/timeline/timeline_item.tsx
+++ b/src/components/timeline/timeline_item.tsx
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import React, { FunctionComponent, HTMLAttributes } from 'react';
+import React, { FunctionComponent } from 'react';
import classNames from 'classnames';
import {
EuiTimelineItemEvent,
@@ -16,9 +16,7 @@ import {
EuiTimelineItemIcon,
EuiTimelineItemIconProps,
} from './timeline_item_icon';
-
-export type EuiTimelineItemProps = HTMLAttributes &
- EuiTimelineItemEventProps &
+export type EuiTimelineItemProps = EuiTimelineItemEventProps &
EuiTimelineItemIconProps;
export const EuiTimelineItem: FunctionComponent = ({
@@ -33,7 +31,7 @@ export const EuiTimelineItem: FunctionComponent = ({
);
return (
-
Move data to the cold tier when you are searching it less often
@@ -103,26 +101,21 @@ export default () => {
buttonElement="div"
buttonContent="Advanced settings"
>
-
+
Any content inside of EuiAccordion will
appear here.
>
)}
- >
- }
- />
+
- Store your most recent, most frequently-searched data in the hot
- tier. The hot tier provides the best indexing and search
- performance by using the most powerful, expensive hardware.
-
-
- }
- />
+ >
+
+
+
+
+ Hot phase Required
+
+
+
+
+
+
+
+ Store your most recent, most frequently-searched data in the hot
+ tier. The hot tier provides the best indexing and search
+ performance by using the most powerful, expensive hardware.
+
+
+
+`;
import TimelineComplex from './timeline_complex';
const TimelineComplexSource = require('!!raw-loader!./timeline_complex');
@@ -54,7 +59,7 @@ export const TimelineExample = {
EuiTimeline will generate a timeline thread.
),
- props: { EuiTimeline, EuiTimelineItem, EuiTimelineItemEventPanel },
+ props: { EuiTimeline, EuiTimelineItem },
snippet: timelineSnippet,
demo: ,
},
@@ -79,15 +84,8 @@ export const TimelineExample = {
icon: main icon that appears on the left side.
- header: the most important part of an event
- (e.g. a title, username, metadata). The content should be in one
- line. When no body is passed it vertically
- center aligns with the icon.
-
-
- body: additional event content. You can also
- use this prop to pass more complex components (e.g. editors, code
- blocks or any custom component).
+ children: event content. You can pass any type
+ of node.
- An event is basically the right side of the{' '}
- EuiTimelineItem and it's built on top of the{' '}
+ Although any node is allowed as a children the
+ recommendation is to use a{' '}
EuiPanel
-
- . This example demonstrates how you can use{' '}
- panelProps to customize an event.
+ {' '}
+ or a{' '}
+
+ EuiSplitPanel
+ {' '}
+ when you content is text based. For other type of components like
+ editors, the recommendation is to pass as a children without any
+ wrapper.
The EuiTimeline is a component that standardizes the
- way a timeline thread is displayed. But it gives the ability to add
- custom components and icons. Pass an array of{' '}
+ way a timeline thread is displayed. Pass an array of{' '}
EuiTimelineItem objects and{' '}
EuiTimeline will generate a timeline thread.
@@ -113,9 +112,9 @@ export const TimelineExample = {
EuiSplitPanel
{' '}
- when you content is text based. For other type of components like
- editors, the recommendation is to pass as a children without any
- wrapper.
+ when your content is text-based. For other types of components like
+ editors, the recommendation is to pass the{' '}
+ children without any wrapper.
+
+ janet@elastic.co
+
+ was invited to the project
+
+
+
+
+
+
+
+
+ email
+
+
+
+
+
+
+
+ janet@elastic.co
+
+ was invited to the project
+
+
+
+
+`;
diff --git a/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
new file mode 100644
index 00000000000..4f82c60855d
--- /dev/null
+++ b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`EuiTimelineItem is rendered 1`] = `
+
+
+
+
+
+ dot
+
+
+
+
+
+
+ I'm the children
+
+
+
+`;
+
+exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
+
+
+
+
+
+ dot
+
+
+
+
+
+
+ I'm the children
+
+
+
+`;
+
+exports[`EuiTimelineItem props verticalAlign top is rendered 1`] = `
+
+
+
+
+
+ dot
+
+
+
+
+
+
+ I'm the children
+
+
+
+`;
diff --git a/src/components/timeline/index.ts b/src/components/timeline/index.ts
index d06ff0e0806..bd23b8eb59c 100644
--- a/src/components/timeline/index.ts
+++ b/src/components/timeline/index.ts
@@ -6,12 +6,15 @@
* Side Public License, v 1.
*/
-export type { EuiTimelineItemProps } from './timeline_item';
+export type { EuiTimelineProps } from './timeline';
+export { EuiTimeline } from './timeline';
+
+export type {
+ EuiTimelineItemProps,
+ EuiTimelineItemVerticalAlign,
+} from './timeline_item';
export { EuiTimelineItem } from './timeline_item';
export { EuiTimelineItemEvent } from './timeline_item_event';
export { EuiTimelineItemIcon } from './timeline_item_icon';
-
-export type { EuiTimelineProps } from './timeline';
-export { EuiTimeline } from './timeline';
diff --git a/src/components/timeline/timeline.test.tsx b/src/components/timeline/timeline.test.tsx
new file mode 100644
index 00000000000..fefd53e8e5a
--- /dev/null
+++ b/src/components/timeline/timeline.test.tsx
@@ -0,0 +1,41 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React from 'react';
+import { render } from 'enzyme';
+import { EuiAvatar } from '../avatar';
+import { EuiTimeline, EuiTimelineProps } from './timeline';
+
+describe('EuiTimeline', () => {
+ test('is rendered with items', () => {
+ const items: EuiTimelineProps['items'] = [
+ {
+ icon: ,
+ verticalAlign: 'center',
+ children: (
+
+ ),
+ },
+ ];
+
+ const component = render();
+
+ expect(component).toMatchSnapshot();
+ });
+});
diff --git a/src/components/timeline/timeline_item.test.tsx b/src/components/timeline/timeline_item.test.tsx
new file mode 100644
index 00000000000..990770c015a
--- /dev/null
+++ b/src/components/timeline/timeline_item.test.tsx
@@ -0,0 +1,47 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import React from 'react';
+import { render } from 'enzyme';
+import { EuiAvatar } from '../avatar';
+import { EuiTimelineItem, VERTICAL_ALIGN } from './timeline_item';
+
+describe('EuiTimelineItem', () => {
+ test('is rendered', () => {
+ const component = render(
+ }
+ >
+
Move data to the cold tier when you are searching it less often
- and don’t need to update it. The cold tier is optimized for cost
- savings over search performance.
+ and don't need to update it. The cold tier is optimized for
+ cost savings over search performance.
I'm the children
@@ -37,13 +37,13 @@ exports[`EuiTimelineItem is rendered 1`] = `
exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
I'm the children
@@ -72,13 +72,13 @@ exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
exports[`EuiTimelineItem props verticalAlign top is rendered 1`] = `
I'm the children
diff --git a/src/components/timeline/_index.scss b/src/components/timeline/_index.scss
deleted file mode 100644
index afa36a003f0..00000000000
--- a/src/components/timeline/_index.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-@import 'timeline_item';
-@import 'timeline_item_event';
-@import 'timeline_item_icon';
\ No newline at end of file
diff --git a/src/components/timeline/_timeline_item.scss b/src/components/timeline/_timeline_item.scss
deleted file mode 100644
index bbb016d319b..00000000000
--- a/src/components/timeline/_timeline_item.scss
+++ /dev/null
@@ -1,40 +0,0 @@
-.euiTimelineItem {
- font-size: $euiFontSizeS;
- display: flex;
- padding-bottom: $euiSize;
- min-height: $euiSize * 3.5;
-}
-
-.euiTimelineItem:last-of-type {
- .euiTimelineItemIcon {
- &::before {
- display: none;
- }
- }
-}
-
-// Vertical align items
-.euiTimelineItem--verticalAlignTop {
- .euiTimelineItemIcon {
- align-items: flex-start;
- }
-
- .euiTimelineItemEvent {
- align-self: flex-start;
- }
-}
-
-.euiTimelineItem--verticalAlignCenter {
- .euiTimelineItemIcon {
- align-items: center;
-
- // when the vertical alignment is center the vertical line starts in the middle of the container
- &::before {
- top: 50%;
- }
- }
-
- .euiTimelineItemEvent {
- align-self: center;
- }
-}
\ No newline at end of file
diff --git a/src/components/timeline/_timeline_item_event.scss b/src/components/timeline/_timeline_item_event.scss
deleted file mode 100644
index 8ce0775b2ba..00000000000
--- a/src/components/timeline/_timeline_item_event.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.euiTimelineItemEvent {
- flex: 1;
-}
-
diff --git a/src/components/timeline/_timeline_item_icon.scss b/src/components/timeline/_timeline_item_icon.scss
deleted file mode 100644
index 41be2a2378f..00000000000
--- a/src/components/timeline/_timeline_item_icon.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-.euiTimelineItemIcon {
- display: flex;
- position: relative;
- flex-grow: 0;
- margin-right: $euiSize;
-
- // timeline vertical line
- &::before {
- content: '';
- position: absolute;
- left: $euiSizeXXL / 2;
- top: $euiSize;
- width: $euiSizeXS / 2;
- background-color: $euiColorLightShade;
- height: calc(100% + #{$euiSize});
- }
-}
-
-.euiTimelineItemIcon__content {
- min-width: $euiSizeXXL;
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
-}
diff --git a/src/components/timeline/timeline_item.styles.ts b/src/components/timeline/timeline_item.styles.ts
new file mode 100644
index 00000000000..47d5c13b657
--- /dev/null
+++ b/src/components/timeline/timeline_item.styles.ts
@@ -0,0 +1,50 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { css } from '@emotion/react';
+import { UseEuiTheme } from '../../services';
+
+export const euiTimelineItemStyles = ({ euiTheme }: UseEuiTheme) => ({
+ // Base
+ euiTimelineItem: css`
+ display: flex;
+ padding-bottom: ${euiTheme.size.base};
+ min-height: calc(${euiTheme.size.base} * 3.5);
+
+ &:last-of-type {
+ .euiTimelineItemIcon {
+ &::before {
+ display: none;
+ }
+ }
+ `,
+ // Vertical alignments: css`
+ top: css`
+ .euiTimelineItemIcon {
+ align-items: flex-start;
+ }
+
+ .euiTimelineItemEvent {
+ align-self: flex-start;
+ }
+ `,
+ center: css`
+ .euiTimelineItemIcon {
+ align-items: center;
+
+ // when the vertical alignment is center the vertical line starts in the middle of the container
+ &::before {
+ top: 50%;
+ }
+ }
+
+ .euiTimelineItemEvent {
+ align-self: center;
+ }
+ `,
+});
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
index 4aafe71a61c..940eb1c6b42 100644
--- a/src/components/timeline/timeline_item.tsx
+++ b/src/components/timeline/timeline_item.tsx
@@ -17,6 +17,8 @@ import {
EuiTimelineItemIconProps,
} from './timeline_item_icon';
import { CommonProps, keysOf } from '../common';
+import { useEuiTheme } from '../../services';
+import { euiTimelineItemStyles } from './timeline_item.styles';
const verticalAlignToClassNameMap = {
top: 'euiTimelineItem--verticalAlignTop',
@@ -41,15 +43,21 @@ export const EuiTimelineItem: FunctionComponent = ({
verticalAlign = 'top',
icon,
className,
+ ...rest
}) => {
+ const euiTheme = useEuiTheme();
+ const styles = euiTimelineItemStyles(euiTheme);
+
const classes = classNames(
'euiTimelineItem',
verticalAlignToClassNameMap[verticalAlign as EuiTimelineItemVerticalAlign],
className
);
+ const cssStyles = [styles.euiTimelineItem, styles[verticalAlign]];
+
return (
-
+
{children}
diff --git a/src/components/timeline/timeline_item_event.styles.ts b/src/components/timeline/timeline_item_event.styles.ts
new file mode 100644
index 00000000000..c5b722db4dc
--- /dev/null
+++ b/src/components/timeline/timeline_item_event.styles.ts
@@ -0,0 +1,15 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { css } from '@emotion/react';
+
+export const euiTimelineItemEventStyles = () => ({
+ euiTimelineItemEvent: css`
+ flex: 1;
+ `,
+});
diff --git a/src/components/timeline/timeline_item_event.tsx b/src/components/timeline/timeline_item_event.tsx
index 9227febdc18..5b16f177e67 100644
--- a/src/components/timeline/timeline_item_event.tsx
+++ b/src/components/timeline/timeline_item_event.tsx
@@ -7,6 +7,7 @@
*/
import React, { FunctionComponent, ReactNode } from 'react';
+import { euiTimelineItemEventStyles } from './timeline_item_event.styles';
export type EuiTimelineItemEventProps = {
/**
@@ -18,5 +19,12 @@ export type EuiTimelineItemEventProps = {
export const EuiTimelineItemEvent: FunctionComponent = ({
children,
}) => {
- return
- Move data to the cold tier when you are searching it less often
- and don't need to update it. The cold tier is optimized for
- cost savings over search performance.
-
- Store your most recent, most frequently-searched data in the hot
- tier. The hot tier provides the best indexing and search
- performance by using the most powerful, expensive hardware.
-
- Although any node is allowed as a children the
- recommendation is to use a{' '}
+ You can create a timeline thread by rendering multiple{' '}
+ EuiTimelineItem. Wrapping these components with a{' '}
+ EuiTimeline is not required, but we recommend
+ having all the EuiTimelineItem nested in the same
+ container. This way, we ensure that timeline styles are applied
+ correctly.
+
+
+ Although any node is allowed as a children in a{' '}
+ EuiTimelineItem, the recommendation is to use a{' '}
EuiPanel
{' '}
@@ -118,32 +126,19 @@ export const TimelineExample = {
editors, the recommendation is to pass the{' '}
children without any wrapper.
- This is an example of how you can customize and display multiple{' '}
- EuiTimelineItem.
+ The following example shows how to display multiple{' '}
+ EuiTimelineItem and how you can use a{' '}
+ EuiSplitPanel to customize an event.
-
-
-
+ // We could use the `euiPaletteColorBlind` for coloring the avatars
+ // But because we're placing an icon on top of these colors
+ // The `euiPaletteColorBlindBehindText` is a better choice to ensure better contrast
+ const colorBlindBehindText = euiPaletteColorBlindBehindText({
+ sortBy: 'natural',
+ });
+
+ const onChange1 = (e: EuiSwitchEvent) => setChecked1(e.target.checked);
+ const onChange2 = (e: EuiSwitchEvent) => setChecked2(e.target.checked);
+
+ const onChange3 = (e: EuiSwitchEvent) => setChecked3(e.target.checked);
+
+ const phase = (
+ title: string,
+ checked: boolean,
+ onChange: (e: EuiSwitchEvent) => void,
+ avatarColor: string
+ ) => (
+ checked ? (
+
+ ) : (
+
+ )
}
>
-
-
-
+
+
+
+
+
+
+
+
+
{title}
+
+
+
+
+
+
+
- Nicole generated a new iframe 2 minutes ago
+ Move data to the cold tier when you are searching it less often
+ and don't need to update it. The cold tier is optimized for
+ cost savings over search performance.
+ Store your most recent, most frequently-searched data in the hot
+ tier. The hot tier provides the best indexing and search
+ performance by using the most powerful, expensive hardware.
+
I'm a children and you can find the{' '}
diff --git a/src-docs/src/views/timeline/timeline_item_event.tsx b/src-docs/src/views/timeline/timeline_item_event.tsx
index ab0c7040b4a..562ef727e27 100644
--- a/src-docs/src/views/timeline/timeline_item_event.tsx
+++ b/src-docs/src/views/timeline/timeline_item_event.tsx
@@ -53,12 +53,12 @@ export default () => {
checked ? (
) : (
-
+
)
}
>
@@ -116,7 +116,7 @@ export default () => {
icon={
diff --git a/src/components/timeline/timeline_item.tsx b/src/components/timeline/timeline_item.tsx
index a3a895a54ca..2d74fa60d3c 100644
--- a/src/components/timeline/timeline_item.tsx
+++ b/src/components/timeline/timeline_item.tsx
@@ -35,7 +35,7 @@ export interface EuiTimelineItemProps
EuiTimelineItemIconProps,
EuiTimelineItemEventProps {
/**
- * Vertical aligns the event with the icon
+ * Vertical alignment of the event with the icon
*/
verticalAlign?: EuiTimelineItemVerticalAlign;
}
From 728b1bb58c6d5835d31d461d9e36f6c57a335895 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Fri, 1 Apr 2022 17:36:19 +0100
Subject: [PATCH 29/59] Linking `steps` and `comments` components
---
.../src/views/timeline/timeline_example.js | 35 +++++++++++++++----
.../timeline/timeline_item.styles.ts | 2 +-
.../timeline/timeline_item_event.tsx | 2 +-
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index a018bd08bd1..9104a2b4d5a 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -54,12 +54,35 @@ export const TimelineExample = {
},
],
text: (
-
- The EuiTimeline is a component that standardizes the
- way a timeline thread is displayed. Pass an array of{' '}
- EuiTimelineItem objects and{' '}
- EuiTimeline will generate a timeline thread.
-
+ <>
+
+ The EuiTimeline is a component that standardizes
+ the way a timeline thread is displayed. Pass an array of{' '}
+ EuiTimelineItem objects and{' '}
+ EuiTimeline will generate a timeline thread.
+
+
+ This component allows you to create any type of timeline, but for
+ more specific use cases you should consider:
+
+
+
+
+ EuiSteps
+
+ : a timeline that allows you to present instructional content that
+ must be conducted in a particular order and might contain progress
+ indications.
+
+
+
+ EuiCommentList
+
+ : a timeline that allows you to display comments or logging
+ actions that either a user or a system has performed.
+
- Although any node is allowed as a children in a{' '}
- EuiTimelineItem, the recommendation is to use a{' '}
-
- EuiPanel
- {' '}
- or a{' '}
-
- EuiSplitPanel
- {' '}
- when your content is text-based. For other types of components like
- editors, the recommendation is to pass the{' '}
- children without any wrapper.
+ When passing an icon and{' '}
+ children props to each item, there are some
+ design considerations to take into account:
+
+
+ icon: use icons of the same size to create a
+ better visual consistency.
+
+
+ children: when your content is text-based the
+ recommendation is to use a{' '}
+
+ EuiPanel
+ {' '}
+ or a{' '}
+
+ EuiSplitPanel
+ {' '}
+ as a wrapper. For other types of components like editors, the
+ recommendation is to pass the children without any wrapper.
+
+
The following example shows how to display multiple{' '}
EuiTimelineItem and how you can use a{' '}
- EuiSplitPanel to customize an event.
+ EuiSplitPanel as the content wrapper.
- children: when your content is text-based the
- recommendation is to use a{' '}
+ children: when your content is just one line of
+ text, the recommendation is to use a a{' '}
+
+ EuiText
+ {' '}
+ as a wrapper. For multi-line content consider using a{' '}
EuiPanel
{' '}
@@ -157,7 +161,7 @@ export const TimelineExample = {
EuiSplitPanel
{' '}
- as a wrapper. For other types of components like editors, the
+ instead. For other types of components like editors, the
recommendation is to pass the children without any wrapper.
I'm the children
@@ -37,13 +37,13 @@ exports[`EuiTimelineItem is rendered 1`] = `
exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
I'm the children
@@ -72,13 +72,13 @@ exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
exports[`EuiTimelineItem props verticalAlign top is rendered 1`] = `
- The EuiTimeline is a component that standardizes
+ The EuiTimeline component standardizes
the way a timeline thread is displayed. Pass an array of{' '}
EuiTimelineItem objects and{' '}
EuiTimeline will generate a timeline thread.
From 3bb564f2116e720af45dc73d3726c92a995de20b Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Thu, 7 Apr 2022 11:21:03 +0100
Subject: [PATCH 44/59] Update src-docs/src/views/timeline/timeline_example.js
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
---
src-docs/src/views/timeline/timeline_example.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index 6c3acd41f06..dc9890fc5ef 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -131,7 +131,7 @@ export const TimelineExample = {
<>
You can create a timeline thread by rendering multiple{' '}
- EuiTimelineItem. Wrapping these components with a{' '}
+ EuiTimelineItem components. Wrapping these with an{' '}
EuiTimeline is not required, but we recommend
having all the EuiTimelineItem nested in the same
container. This way, we ensure that timeline styles are applied
From 525b98d63099a4207853ea88a1d5ff3c23423760 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Thu, 7 Apr 2022 11:21:11 +0100
Subject: [PATCH 45/59] Update src-docs/src/views/timeline/timeline_example.js
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
---
src-docs/src/views/timeline/timeline_example.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index dc9890fc5ef..125e6cf622f 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -133,7 +133,7 @@ export const TimelineExample = {
You can create a timeline thread by rendering multiple{' '}
EuiTimelineItem components. Wrapping these with an{' '}
EuiTimeline is not required, but we recommend
- having all the EuiTimelineItem nested in the same
+ having all the EuiTimelineItems nested in the same
container. This way, we ensure that timeline styles are applied
correctly.
- Use EuiTimelineItem to display timeline items. Each{' '}
+ Each{' '}
EuiTimelineItem has two parts: an icon on the left
side and an event on the right side. To create an item you basically
need the following props:
From cf1dc533e57ef3c42a8e75b2560546e30de3caa0 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Thu, 7 Apr 2022 11:21:43 +0100
Subject: [PATCH 48/59] Update src-docs/src/views/timeline/timeline_example.js
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
---
src-docs/src/views/timeline/timeline_example.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index cbdb0f8f7b8..69e7f1ddfbc 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -167,7 +167,7 @@ export const TimelineExample = {
The following example shows how to display multiple{' '}
- EuiTimelineItem and how you can use a{' '}
+ EuiTimelineItems and how you can use a{' '}
EuiSplitPanel as the content wrapper.
When passing an icon and{' '}
- children props to each item, there are some
+ children prop to each item, there are some
design considerations to take into account:
Each{' '}
EuiTimelineItem has two parts: an icon on the left
- side and an event on the right side. To create an item you basically
+ side and an event on the right side. To create an item you
need the following props:
- The EuiTimeline component standardizes
- the way a timeline thread is displayed. Pass an array of{' '}
+ The EuiTimeline component standardizes the way a
+ timeline thread is displayed. Pass an array of{' '}
EuiTimelineItem objects and{' '}
EuiTimeline will generate a timeline thread.
- Each{' '}
- EuiTimelineItem has two parts: an icon on the left
- side and an event on the right side. To create an item you
- need the following props:
+ Each EuiTimelineItem has two parts: an icon on the
+ left side and an event on the right side. To create an item you need
+ the following props:
- icon: main icon that appears on the left side. Can be passed as any IconType string or custom node.
+ icon: main icon that appears on the left side.
+ Can be passed as any IconType string or custom
+ node.
children: any node as the event content.
@@ -139,8 +140,8 @@ export const TimelineExample = {
When passing an icon and{' '}
- children prop to each item, there are some
- design considerations to take into account:
+ children prop to each item, there are some design
+ considerations to take into account:
I'm the children
@@ -37,10 +37,10 @@ exports[`EuiTimelineItem is rendered 1`] = `
exports[`EuiTimelineItem props verticalAlign center is rendered 1`] = `
I'm the children and you can find the{' '}
From 8c910175d68191999ab6a7490f0580fc80f1d0d2 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Thu, 7 Apr 2022 14:36:29 +0100
Subject: [PATCH 54/59] Fixing path to type
---
src/components/timeline/timeline_item_event.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/timeline/timeline_item_event.tsx b/src/components/timeline/timeline_item_event.tsx
index 78f7cfc1a37..6b40a3040e5 100644
--- a/src/components/timeline/timeline_item_event.tsx
+++ b/src/components/timeline/timeline_item_event.tsx
@@ -8,7 +8,7 @@
import React, { FunctionComponent, ReactNode } from 'react';
import { euiTimelineItemEventStyles } from './timeline_item_event.styles';
-import { EuiTimelineItemVerticalAlign } from './';
+import { EuiTimelineItemVerticalAlign } from './timeline_item';
export interface EuiTimelineItemEventProps {
/**
From 28496cbc88f7e676fb2be83cc5afe8a31cf103b8 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Thu, 7 Apr 2022 15:49:30 +0100
Subject: [PATCH 55/59] Recommendation for icon size
---
src-docs/src/views/timeline/timeline_example.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src-docs/src/views/timeline/timeline_example.js b/src-docs/src/views/timeline/timeline_example.js
index 1ffa372d639..79e78e59765 100644
--- a/src-docs/src/views/timeline/timeline_example.js
+++ b/src-docs/src/views/timeline/timeline_example.js
@@ -107,7 +107,11 @@ export const TimelineExample = {
icon: main icon that appears on the left side.
Can be passed as any IconType string or custom
- node.
+ node (e.g.{' '}
+
+ EuiAvatar
+
+ ). It is recommended not to use an element larger than 40x40.
I'm the children and you can find the{' '}
diff --git a/src/components/timeline/__snapshots__/timeline.test.tsx.snap b/src/components/timeline/__snapshots__/timeline.test.tsx.snap
index f32f9c108e2..c062531bb7a 100644
--- a/src/components/timeline/__snapshots__/timeline.test.tsx.snap
+++ b/src/components/timeline/__snapshots__/timeline.test.tsx.snap
@@ -49,17 +49,15 @@ exports[`EuiTimeline is rendered with items 1`] = `
class="css-irfkcc-euiTimelineItemIcon__content"
>
- bolt
-
+ />
diff --git a/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
index b9cc62b3f21..26277570d03 100644
--- a/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
+++ b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
@@ -1,6 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiTimelineItem is rendered 1`] = `
+
+
+
+
+
+
+
+
+
+
+ I'm the children
+
+
+
+`;
+
+exports[`EuiTimelineItem props EuiAvatar is passed as an icon 1`] = `