Skip to content

Commit

Permalink
Make avatar border optional through CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
clintandrewhall committed Dec 31, 2024
1 parent 1b1c457 commit 16e0ccd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
22 changes: 0 additions & 22 deletions x-pack/platform/packages/shared/ai-assistant/icon/avatar.styles.ts

This file was deleted.

5 changes: 1 addition & 4 deletions x-pack/platform/packages/shared/ai-assistant/icon/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import React from 'react';
import { EuiAvatar, EuiAvatarProps } from '@elastic/eui';

import { AssistantIcon } from './icon';
import { useStyles } from './avatar.styles';

/**
* Avatar component for the AI Assistant.
Expand All @@ -23,11 +22,9 @@ export type AssistantAvatarProps = Omit<
* A `EuiAvatar` component customized for the AI Assistant.
*/
export const AssistantAvatar = ({
css,
color = 'plain',
size = 'm',
...props
}: AssistantAvatarProps) => {
const { root } = useStyles();
return <EuiAvatar {...{ ...props, color, size }} css={[root, css]} iconType={AssistantIcon} />;
return <EuiAvatar {...{ ...props, color, size }} iconType={AssistantIcon} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { AssistantAvatar } from '@kbn/ai-assistant-icon';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
Expand All @@ -14,6 +14,14 @@ import { useActions } from '../state';
import { Steps } from './steps';
import * as i18n from './translations';

const useAvatarCss = () => {
const { euiTheme } = useEuiTheme();
return css`
border: 1px solid ${euiTheme.colors.lightShade};
padding: ${euiTheme.size.xs};
`;
};

const contentCss = css`
width: 100%;
max-width: 730px;
Expand All @@ -25,6 +33,7 @@ interface HeaderProps {
}
export const Header = React.memo<HeaderProps>(({ currentStep, isGenerating }) => {
const { setStep } = useActions();
const avatarCss = useAvatarCss();

return (
<KibanaPageTemplate.Header>
Expand All @@ -40,7 +49,7 @@ export const Header = React.memo<HeaderProps>(({ currentStep, isGenerating }) =>
justifyContent="center"
>
<EuiFlexItem grow={false}>
<AssistantAvatar name={i18n.ASSISTANT_AVATAR} />
<AssistantAvatar css={avatarCss} name={i18n.ASSISTANT_AVATAR} />
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
Expand Down

0 comments on commit 16e0ccd

Please sign in to comment.