Skip to content

Commit

Permalink
Replace SCSS with Emotion in solution_nav_avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Dec 17, 2024
1 parent a7cdf2a commit d4c9f09
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import './solution_nav_avatar.scss';

import { css } from '@emotion/css';
import React, { FunctionComponent } from 'react';
import classNames from 'classnames';

import { DistributiveOmit, EuiAvatar, EuiAvatarProps } from '@elastic/eui';
import {
DistributiveOmit,
EuiAvatar,
EuiAvatarProps,
useEuiTheme,
useEuiShadow,
} from '@elastic/eui';

export type KibanaPageTemplateSolutionNavAvatarProps = DistributiveOmit<EuiAvatarProps, 'size'> & {
/**
Expand All @@ -27,13 +32,30 @@ export type KibanaPageTemplateSolutionNavAvatarProps = DistributiveOmit<EuiAvata
export const KibanaPageTemplateSolutionNavAvatar: FunctionComponent<
KibanaPageTemplateSolutionNavAvatarProps
> = ({ className, size, ...rest }) => {
const { euiTheme } = useEuiTheme();

const pageTemplateSolutionNavAvatarStyles = {
base: css`
${css(useEuiShadow('s'))};
`,
xxl: css`
${useEuiShadow('m')};
line-height: 100px;
border-radius: 100px;
display: inline-block;
background: ${euiTheme.colors.backgroundBasePlain} url('../../assets/texture.svg') no-repeat;
background-size: cover, 125%;
text-align: center;
`,
};

return (
// @ts-ignore Complains about ExclusiveUnion between `iconSize` and `iconType`, but works fine
// @ts-expect-error Complains about ExclusiveUnion between `iconSize` and `iconType`, but works fine
<EuiAvatar
className={classNames(
'kbnPageTemplateSolutionNavAvatar',
pageTemplateSolutionNavAvatarStyles.base,
{
[`kbnPageTemplateSolutionNavAvatar--${size}`]: size,
[pageTemplateSolutionNavAvatarStyles.xxl]: size === 'xxl',
},
className
)}
Expand Down

0 comments on commit d4c9f09

Please sign in to comment.