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

[Page Layouts] Adding content props to EuiPageHeader for pre-determined page layout patterns #4451

Merged
merged 35 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cb8817a
Added content type props to EuiPageHeader
Jan 26, 2021
b54aae4
Replaced example usages with props
Jan 26, 2021
06afe85
Setting up a new $`euiPageDefaultMaxWidth` sass token
Jan 26, 2021
a2b0e6f
Updating playground & docs
Jan 26, 2021
c19d038
Fixin amsterdam small and reverse shadows
Jan 26, 2021
eff79dc
‘Fixing’ paddingSize prop on EuiPageContent
Jan 26, 2021
206351c
Adding custom options for `restrictWidth`
Jan 28, 2021
6413fb4
Starting the switch to a new component `EuiPageHeaderContent`
Jan 28, 2021
59643df
middle; simulate node
thompsongl Jan 29, 2021
517542d
Update `useIsWithinBreakpoints` to be conditional
Jan 29, 2021
ea27ca0
Moving the content to a new component
Jan 29, 2021
20f3bb9
Cleaning up
Jan 29, 2021
09285bf
Playground fix
Jan 29, 2021
a3051f2
more customProps
thompsongl Feb 1, 2021
eb08a9d
Merge branch 'props/page_header' into props/page_header
cchaos Feb 2, 2021
b4df1a7
Merge pull request #39 from thompsongl/props/page_header
cchaos Feb 2, 2021
a5b6eb5
prevent format errors
thompsongl Feb 3, 2021
199ade3
Merge pull request #40 from thompsongl/props/page_header
cchaos Feb 3, 2021
373fa5e
Some cleanup and fixing of logic
Feb 3, 2021
2a59f32
Added `stretch` to the align prop and fixed tests
Feb 3, 2021
46929e1
Merge remote-tracking branch 'upstream/master' into props/page_header
Feb 3, 2021
27d7815
cl & comments
Feb 3, 2021
18a429b
Docs clarity
snide Feb 4, 2021
5d1ea82
words
snide Feb 4, 2021
f6108ef
Apply suggestions from code review
cchaos Feb 4, 2021
7dec3f6
Merge pull request #41 from snide/docs/pageheader
cchaos Feb 4, 2021
fb2c6b9
Render `<header>` element in EuiPageHeader
Feb 8, 2021
fc50d95
Adding `iconProps` to optional icon
Feb 8, 2021
e3f1ce1
Renaming `rightSideContent` to `rightSideItems` for better clarity of…
Feb 8, 2021
f0964c0
Replacing `rightSideResponsive` with a more generic `rightSideGroupPr…
Feb 8, 2021
df17134
Merge branch 'master' into props/page_header
cchaos Feb 8, 2021
7d557fc
Apply suggestions from code review
cchaos Feb 10, 2021
f573ebb
Merge branch 'master' into props/page_header
cchaos Feb 10, 2021
e97d3b8
Set deprecation notice for `panelPaddingSize`
Feb 10, 2021
9615bcc
Merge branch 'master' into props/page_header
cchaos Feb 10, 2021
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
- Added `EuiOverlayMask` directly to `EuiModal` ([#4480](https://github.com/elastic/eui/pull/4480))
- Added `paddingSize` prop to `EuiFlyout` ([#4448](https://github.com/elastic/eui/pull/4448))
- Added `size='l'` prop to `EuiTabs` ([#4501](https://github.com/elastic/eui/pull/4501))
- Added content-specific props (`pageTitle`, `description`, `tabs`, `rightSideItems`) to `EuiPageHeader` by creating a new `EuiPageHeaderContent` component ([#4451](https://github.com/elastic/eui/pull/4451))
- Added `isActive` parameter to the `useIsWithinBreakpoints` hook ([#4451](https://github.com/elastic/eui/pull/4451))

**Bug fixes**

Expand All @@ -12,6 +14,11 @@
- Fixed `EuiCodeBlock` focus-state if content overflows [#4463](https://github.com/elastic/eui/pull/4463)
- Fixed issues in `EuiDataGrid` around unnecessary scroll bars and container heights not updating ([#4468](https://github.com/elastic/eui/pull/4468))

**Theme: Amsterdam**

- Increased `EuiPage`'s default `restrictWidth` size to `1200px` (extra large breakpoint) ([#4451](https://github.com/elastic/eui/pull/4451))
- Reduced size of `euiBottomShadowSmall` by one layer ([#4451](https://github.com/elastic/eui/pull/4451))

## [`31.5.0`](https://github.com/elastic/eui/tree/v31.5.0)

- Added `isLoading` prop and added `EuiOverlayMask` directly to `EuiConfirmModal` ([#4421](https://github.com/elastic/eui/pull/4421))
Expand Down
9 changes: 7 additions & 2 deletions src-docs/src/components/guide_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ $guideZLevelHighest: $euiZLevel9 + 1000;
min-height: 100vh;
background-color: $euiColorEmptyShade;
border-left: $euiBorderThin;
max-width: 1000px;
max-width: $euiPageDefaultMaxWidth;
margin-left: 240px;
}

Expand All @@ -105,11 +105,16 @@ $guideZLevelHighest: $euiZLevel9 + 1000;
min-height: 460px;
}

div {
> div,
> div > div {
background: transparentize($euiColorPrimary, .9);
}
}

.guideDemo__highlightLayout--single {
background: transparentize($euiColorPrimary, .9);
}

.guideDemo__highlightSpacer {
.euiSpacer {
background: transparentize($euiColorPrimary, .9);
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/services/playground/_playground_compiler.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
@if (lightness($euiTextColor) < 50) {
background: $euiColorDarkestShade;
}
}
}
2 changes: 1 addition & 1 deletion src-docs/src/services/playground/createOptionalEnum.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const createOptionalEnum = (prop = { options: {} }) => {
const newProp = {
...prop,
options: {
none: '-- No value selected --',
none: '',
...prop.options,
},
defaultValue: 'none',
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/services/playground/iconValidator.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { iconTypes } from '../../views/icon/icons';
import { iconTypes as logoTypes } from '../../views/icon/logos';
import { mapOptions } from './mapOptions';
import { PropTypes } from 'react-view';

const iconOptions = mapOptions(iconTypes);
const iconOptions = mapOptions(iconTypes.concat(logoTypes));

export const iconValidator = (prop = { custom: {} }) => {
const newProp = {
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/services/playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export { iconValidator } from './iconValidator';
export { createOptionalEnum } from './createOptionalEnum';
export { dummyFunction } from './dummyFunction';
export { simulateFunction } from './simulateFunction';
export { generateAst, generateCustomProps } from './utils';
5 changes: 3 additions & 2 deletions src-docs/src/services/playground/knobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ const Knob = ({
isInvalid={error && error.length > 0}
compressed
fullWidth
hasNoInitialSelection={!valueKey && !defaultValue}
/>
</EuiFormRow>
);
Expand Down Expand Up @@ -241,11 +242,11 @@ const Knob = ({
<EuiSwitch
id={name}
label={custom.label || ''}
checked={typeof val !== 'undefined' && val}
checked={typeof val !== 'undefined' && Boolean(val)}
onChange={(e) => {
const value = e.target.checked;

set(value ? value : undefined);
set(value ? custom.value ?? e.target.checked : undefined);
}}
compressed
/>
Expand Down
10 changes: 9 additions & 1 deletion src-docs/src/services/playground/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ export default ({ config, setGhostBackground, playgroundClassName }) => {
newCode = newCode.replace(/(\);)$/m, '');
}

return format(newCode.trim(), ' '.repeat(4));
let formatted;
// TODO: Replace `html-format` with something better.
// Notably, something more jsx-friendly
try {
formatted = format(newCode.trim(), ' '.repeat(4));
} catch {
formatted = newCode.trim();
}
return formatted;
};

const Playground = () => {
Expand Down
16 changes: 16 additions & 0 deletions src-docs/src/services/playground/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import template from '@babel/template';

export const generateAst = (value) => {
return template.ast(String(value), { plugins: ['jsx'] }).expression;
};

export const generateCustomProps = (props) => {
return props.reduce((obj, item) => {
return {
...obj,
[item]: {
generate: generateAst,
},
};
}, {});
};
2 changes: 1 addition & 1 deletion src-docs/src/views/icon/logos.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
EuiCopy,
} from '../../../../src/components';

const iconTypes = [
export const iconTypes = [
'logoAppSearch',
'logoBeats',
'logoBusinessAnalytics',
Expand Down
18 changes: 9 additions & 9 deletions src-docs/src/views/page/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ import {
EuiPageContentHeader,
EuiPageContentHeaderSection,
EuiPageHeader,
EuiPageHeaderSection,
EuiPageSideBar,
EuiTitle,
EuiButton,
} from '../../../../src/components';

export default () => (
<EuiPage>
<EuiPageSideBar>SideBar nav</EuiPageSideBar>
<EuiPageBody component="div">
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l">
<h1>Page title</h1>
</EuiTitle>
</EuiPageHeaderSection>
<EuiPageHeaderSection>Page abilities</EuiPageHeaderSection>
</EuiPageHeader>
<EuiPageHeader
iconType="logoElastic"
pageTitle="Page title"
rightSideItems={[
<EuiButton fill>Add something</EuiButton>,
<EuiButton>Do something</EuiButton>,
]}
/>
<EuiPageContent>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
Expand Down
14 changes: 5 additions & 9 deletions src-docs/src/views/page/page_content_center_with_side_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
EuiPageContentHeader,
EuiPageContentHeaderSection,
EuiPageHeader,
EuiPageHeaderSection,
EuiPageSideBar,
EuiTitle,
} from '../../../../src/components';
Expand All @@ -18,14 +17,11 @@ export default () => (
<EuiPageSideBar>SideBar nav</EuiPageSideBar>
{/* The EUI docs site already has a wrapping <main> tag, so we've changed this example to a <div> for accessibility. You likely don't need to copy the `component` prop for your own usage. */}
<EuiPageBody component="div">
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l">
<h1>Page title</h1>
</EuiTitle>
</EuiPageHeaderSection>
<EuiPageHeaderSection>Page abilities</EuiPageHeaderSection>
</EuiPageHeader>
<EuiPageHeader
pageTitle="Page title"
rightSideItems={['Page abilities']}
alignItems="center"
/>
<EuiPageContent verticalPosition="center" horizontalPosition="center">
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
Expand Down
Loading