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

[EuiEmptyPrompt] Fix styles to work correctly with custom larger breakpoints #7935

Merged
merged 4 commits into from
Aug 1, 2024
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
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/7935.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiEmptyPrompt` to correctly collapse and expand responsively when used with custom breakpoints larger than the default `xl` breakpoint
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EuiImage } from '../image';
import { EuiPageTemplate } from '../page_template';

import { EuiEmptyPrompt, EuiEmptyPromptProps } from './empty_prompt';
import { EuiThemeProvider } from '../../services';

const meta: Meta<EuiEmptyPromptProps> = {
title: 'Display/EuiEmptyPrompt',
Expand Down Expand Up @@ -61,9 +62,11 @@ export const Playground: Story = {

export const PageTemplate: Story = {
render: ({ ...args }) => (
<EuiPageTemplate minHeight="0">
<EuiPageTemplate.EmptyPrompt {...args} />
</EuiPageTemplate>
<EuiThemeProvider modify={{ breakpoint: { xxl: 2000 } }}>
<EuiPageTemplate minHeight="0">
<EuiPageTemplate.EmptyPrompt {...args} />
</EuiPageTemplate>
</EuiThemeProvider>
),
args: {
title: <h2>Create your first visualization</h2>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { css } from '@emotion/react';
import {
euiBreakpoint,
euiMinBreakpoint,
euiPaddingSize,
euiBorderColor,
logicalCSS,
Expand Down Expand Up @@ -45,14 +45,14 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => {
text-align: center;
margin: auto;

${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
/* the width becomes as wide as necessary to contain all of its contents */
${logicalCSS('max-width', 'max-content')}
}
`,
vertical: css``,
horizontal: css`
${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
justify-content: flex-start;
text-align: start;
}
Expand All @@ -68,7 +68,7 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => {
horizontal: css`
align-items: center;

${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
flex-direction: row-reverse;
}
`,
Expand All @@ -83,7 +83,7 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => {
margin: auto;
`,
horizontal: css`
${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
padding-block: ${euiTheme.size.l};
padding-inline: 0;
}
Expand All @@ -105,7 +105,7 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => {
${logicalCSS('margin-bottom', euiTheme.size.base)}
`,
horizontal: css`
${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
${logicalCSS('min-width', '40%')}
${logicalCSS('max-width', '50%')}

Expand All @@ -123,7 +123,7 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => {
euiEmptyPrompt__actions: css``,
vertical: css``,
horizontal: css`
${euiBreakpoint(euiThemeContext, ['l', 'xl'])} {
${euiMinBreakpoint(euiThemeContext, 'l')} {
justify-content: flex-start;
}
`,
Expand Down
Loading