Skip to content

Commit 95518f9

Browse files
[Workspace Chrome] Chore – Move constants to a package (elastic#226835)
## Summary part of elastic/kibana-team#1581 Tiny cleanup, plus we can use this package to export css variable names --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent d88dbe0 commit 95518f9

18 files changed

Lines changed: 92 additions & 6 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ src/core/packages/chrome/browser-internal @elastic/appex-sharedux
127127
src/core/packages/chrome/browser-mocks @elastic/appex-sharedux
128128
src/core/packages/chrome/layout/core-chrome-layout @elastic/appex-sharedux
129129
src/core/packages/chrome/layout/core-chrome-layout-components @elastic/appex-sharedux
130+
src/core/packages/chrome/layout/core-chrome-layout-constants @elastic/appex-sharedux
130131
src/core/packages/config/server-internal @elastic/kibana-core
131132
src/core/packages/custom-branding/browser @elastic/appex-sharedux
132133
src/core/packages/custom-branding/browser-internal @elastic/appex-sharedux

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"@kbn/core-chrome-browser-internal": "link:src/core/packages/chrome/browser-internal",
287287
"@kbn/core-chrome-layout": "link:src/core/packages/chrome/layout/core-chrome-layout",
288288
"@kbn/core-chrome-layout-components": "link:src/core/packages/chrome/layout/core-chrome-layout-components",
289+
"@kbn/core-chrome-layout-constants": "link:src/core/packages/chrome/layout/core-chrome-layout-constants",
289290
"@kbn/core-config-server-internal": "link:src/core/packages/config/server-internal",
290291
"@kbn/core-custom-branding-browser": "link:src/core/packages/custom-branding/browser",
291292
"@kbn/core-custom-branding-browser-internal": "link:src/core/packages/custom-branding/browser-internal",

src/core/packages/chrome/layout/core-chrome-layout-components/application/layout_application.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import React, { ReactNode } from 'react';
1111

1212
import { useEuiOverflowScroll } from '@elastic/eui';
13+
import { APP_MAIN_SCROLL_CONTAINER_ID } from '@kbn/core-chrome-layout-constants';
1314

1415
import { styles } from './layout_application.styles';
1516

@@ -31,7 +32,7 @@ export const LayoutApplication = ({
3132
const overflow = useEuiOverflowScroll('y');
3233

3334
return (
34-
<main css={[styles.root, overflow]} id={'app-main-scroll'}>
35+
<main css={[styles.root, overflow]} id={APP_MAIN_SCROLL_CONTAINER_ID}>
3536
{topBar && <div css={styles.topBar}>{topBar}</div>}
3637
<div css={[styles.content]}>{children}</div>
3738
{bottomBar && <div css={styles.bottomBar}>{bottomBar}</div>}

src/core/packages/chrome/layout/core-chrome-layout-components/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@
1919
"exclude": [
2020
"target/**/*"
2121
],
22-
"kbn_references": []
22+
"kbn_references": [
23+
"@kbn/core-chrome-layout-constants",
24+
]
2325
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# @kbn/core-chrome-layout-constants
2+
3+
Light package that contains constants used in the core chrome layout.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
/**
11+
* The ID of the main scroll container in the application.
12+
* `document.getElementById(APP_MAIN_SCROLL_CONTAINER_ID)` can be used to find the main scroll container
13+
*/
14+
export const APP_MAIN_SCROLL_CONTAINER_ID = 'app-main-scroll';
15+
16+
/**
17+
* The ID of the fixed viewport container in the application.
18+
* This div is rendered by the `AppFixedViewport` component on the top of the application area and can be used to render fixed elements that should not scroll with the main content.
19+
*/
20+
export const APP_FIXED_VIEWPORT_ID = 'app-fixed-viewport';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
module.exports = {
11+
preset: '@kbn/test',
12+
rootDir: '../../../../../..',
13+
roots: ['<rootDir>/src/core/packages/chrome/layout/core-chrome-layout-constants'],
14+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "shared-common",
3+
"id": "@kbn/core-chrome-layout-constants",
4+
"owner": "@elastic/appex-sharedux",
5+
"group": "platform",
6+
"visibility": "shared"
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@kbn/core-chrome-layout-constants",
3+
"private": true,
4+
"version": "1.0.0",
5+
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "../../../../../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "target/types",
5+
"types": [
6+
"jest",
7+
"node",
8+
"react"
9+
]
10+
},
11+
"include": [
12+
"**/*.ts",
13+
"**/*.tsx",
14+
],
15+
"exclude": [
16+
"target/**/*"
17+
],
18+
"kbn_references": []
19+
}

0 commit comments

Comments
 (0)