Skip to content

Commit

Permalink
[EuiTourStep] className consistency with EuiPopover + performance/c…
Browse files Browse the repository at this point in the history
…leanups (#7497)
  • Loading branch information
cee-chen authored Feb 2, 2024
1 parent f5e3c1a commit ff19255
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 788 deletions.
4 changes: 4 additions & 0 deletions changelogs/upcoming/7497.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**Breaking changes**

- `EuiTourStep`'s `className` and `style` props now apply to the anchoring element instead of to the popover panel, to match `EuiPopover` behavior.
- Convert your existing usages to `panelClassName` and `panelStyle` respectively instead.
16 changes: 8 additions & 8 deletions src/components/beacon/__snapshots__/beacon.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`EuiBeacon is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-success-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -14,7 +14,7 @@ exports[`EuiBeacon props color accent is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-accent-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -23,7 +23,7 @@ exports[`EuiBeacon props color danger is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-danger-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -32,7 +32,7 @@ exports[`EuiBeacon props color primary is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-primary-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -41,7 +41,7 @@ exports[`EuiBeacon props color subdued is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-subdued-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -50,7 +50,7 @@ exports[`EuiBeacon props color success is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-success-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -59,7 +59,7 @@ exports[`EuiBeacon props color warning is rendered 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-warning-euiTestCss"
data-test-subj="test subject string"
style="height: 12px; width: 12px;"
style="block-size: 12px; inline-size: 12px;"
/>
`;

Expand All @@ -68,6 +68,6 @@ exports[`EuiBeacon props size accepts size 1`] = `
aria-label="aria-label"
class="euiBeacon testClass1 testClass2 emotion-euiBeacon-success-euiTestCss"
data-test-subj="test subject string"
style="height: 14px; width: 14px;"
style="block-size: 14px; inline-size: 14px;"
/>
`;
20 changes: 13 additions & 7 deletions src/components/beacon/beacon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* Side Public License, v 1.
*/

import React, { FunctionComponent, HTMLAttributes } from 'react';
import React, { FunctionComponent, HTMLAttributes, useMemo } from 'react';
import { CommonProps } from '../common';
import classNames from 'classnames';

import { euiBeaconStyles } from './beacon.styles';
import { logicalStyles } from '../../global_styling';
import { useEuiTheme } from '../../services';

import { euiBeaconStyles } from './beacon.styles';

export const COLORS = [
'subdued',
'primary',
Expand Down Expand Up @@ -51,11 +53,15 @@ export const EuiBeacon: FunctionComponent<EuiBeaconProps> = ({
const styles = euiBeaconStyles(euiTheme);
const cssStyles = [styles.euiBeacon, styles[color]];

const beaconStyle = {
...style,
height: size,
width: size,
};
const beaconStyle = useMemo(
() =>
logicalStyles({
...style,
height: size,
width: size,
}),
[style, size]
);

return (
<div className={classes} css={cssStyles} style={beaconStyle} {...rest} />
Expand Down
Loading

0 comments on commit ff19255

Please sign in to comment.