-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Lens] Color in dimension trigger #76871
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
Changes from 26 commits
dc03598
1118d0c
66f4bd1
5d0192e
d5ba1b3
be3dd02
696f791
1490d31
f3ca265
a78946a
c751be7
8a695d1
3820cfa
4de8419
9e4fb2e
2de1df2
ec31106
4d708bc
b58abd4
9cff0b2
9c80ec2
61e4849
d32cb66
723a3db
8ed06f8
188ed08
b9b6dc5
82580bf
4e0a21f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui'; | ||
| import { AccessorConfig } from '../../../types'; | ||
|
|
||
| export function ColorIndicator({ | ||
| accessorConfig, | ||
| children, | ||
| }: { | ||
| accessorConfig: AccessorConfig; | ||
| children: React.ReactChild; | ||
| }) { | ||
| return ( | ||
| <EuiFlexGroup gutterSize="none" alignItems="center"> | ||
| {accessorConfig.triggerIcon === 'color' && accessorConfig.color && ( | ||
| <EuiFlexItem grow={false}> | ||
| <div | ||
| className="lnsLayerPanel__colorIndicator lnsLayerPanel__colorIndicator--solidColor" | ||
| style={{ | ||
| backgroundColor: accessorConfig.color, | ||
| }} | ||
| /> | ||
| </EuiFlexItem> | ||
| )} | ||
| {accessorConfig.triggerIcon === 'disabled' && ( | ||
| <EuiFlexItem grow={false}> | ||
| <EuiIcon | ||
| type="stopSlash" | ||
| color="subdued" | ||
| size="s" | ||
| className="lnsLayerPanel__colorIndicator" | ||
| /> | ||
| </EuiFlexItem> | ||
| )} | ||
| {accessorConfig.triggerIcon === 'colorBy' && ( | ||
| <EuiFlexItem grow={false}> | ||
| <EuiIcon type="brush" color="text" size="s" className="lnsLayerPanel__colorIndicator" /> | ||
| </EuiFlexItem> | ||
| )} | ||
| <EuiFlexItem>{children}</EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
| import { AccessorConfig } from '../../../types'; | ||
|
|
||
| export function PaletteIndicator({ accessorConfig }: { accessorConfig: AccessorConfig }) { | ||
| if (accessorConfig.triggerIcon !== 'colorBy' || !accessorConfig.palette) return null; | ||
| return ( | ||
| <EuiFlexGroup className="lnsLayerPanel__paletteContainer" gutterSize="none" alignItems="center"> | ||
| {accessorConfig.palette.map((color) => ( | ||
| <EuiFlexItem | ||
| key={color} | ||
| className="lnsLayerPanel__paletteColor" | ||
| grow={true} | ||
| style={{ | ||
| backgroundColor: color, | ||
| }} | ||
| /> | ||
| ))} | ||
| </EuiFlexGroup> | ||
|
Comment on lines
+14
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than rolling out a custom color palette component, would it be better to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This component is very new - the version supporting it is not available in Kibana yet. I'm fine with using it once it becomes available, but #82730 has to get merged first.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Should I open an issue as a reminder? Or is that unnecessary?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't bother, I will take care of it. |
||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.