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

Create new EuiTextBlockTruncate component #7250

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 15 additions & 3 deletions src-docs/src/components/guide_tabbed_page/guide_tabbed_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import {
} from '../../../../src/components';

import { LanguageSelector, ThemeContext } from '../with_theme';
import { GuideSection } from '../guide_section/guide_section';
import {
GuideSection,
GuideSectionProps,
} from '../guide_section/guide_section';

export type GuideTabbedPageProps = PropsWithChildren &
CommonProps & {
Expand Down Expand Up @@ -126,11 +129,20 @@ export const GuideTabbedPage: FunctionComponent<GuideTabbedPageProps> = ({
/>
);
} else {
const PageComponent = page.page;
let rendered: ReactNode;

if (page.page) {
const PageComponent = page.page;
rendered = <PageComponent showSass={showSass} />;
} else {
rendered = page.sections.map((sectionProps: GuideSectionProps) => (
<GuideSection {...sectionProps} />
));
}

return (
<Route key={pathname} path={`${match.path}/${id}`}>
<PageComponent showSass={showSass} />
{rendered}
</Route>
);
}
Expand Down
52 changes: 27 additions & 25 deletions src-docs/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,31 +650,33 @@ const navigation = [
{
name: 'Utilities',
items: [
AccessibilityExample,
AutoSizerExample,
BeaconExample,
ColorPaletteExample,
CopyExample,
UtilityClassesExample,
DelayRenderExample,
ErrorBoundaryExample,
FocusTrapExample,
HighlightAndMarkExample,
HtmlIdGeneratorExample,
InnerTextExample,
I18nExample,
MutationObserverExample,
OutsideClickDetectorExample,
OverlayMaskExample,
PortalExample,
PrettyDurationExample,
ProviderExample,
ResizeObserverExample,
ScrollExample,
TextDiffExample,
TextTruncateExample,
WindowEventExample,
].map((example) => createExample(example)),
...[
AccessibilityExample,
AutoSizerExample,
BeaconExample,
ColorPaletteExample,
CopyExample,
UtilityClassesExample,
DelayRenderExample,
ErrorBoundaryExample,
FocusTrapExample,
HighlightAndMarkExample,
HtmlIdGeneratorExample,
InnerTextExample,
I18nExample,
MutationObserverExample,
OutsideClickDetectorExample,
OverlayMaskExample,
PortalExample,
PrettyDurationExample,
ProviderExample,
ResizeObserverExample,
ScrollExample,
TextDiffExample,
].map((example) => createExample(example)),
createTabbedPage(TextTruncateExample),
createExample(WindowEventExample),
],
},
{
name: 'Package',
Expand Down
25 changes: 25 additions & 0 deletions src-docs/src/views/text_truncate/multi_line.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { css } from '@emotion/react';
import { faker } from '@faker-js/faker';

import { EuiPanel, EuiText, EuiTextBlockTruncate } from '../../../../src';

export default () => {
return (
<EuiText>
<EuiPanel
css={css`
overflow: auto;
resize: horizontal; /* Not all browsers support resize logical properties yet */
resize: inline;
inline-size: 50ch;
max-inline-size: 100%;
`}
>
<EuiTextBlockTruncate lines={3}>
{faker.lorem.lines(10)}
</EuiTextBlockTruncate>
</EuiPanel>
</EuiText>
);
};
Loading
Loading