kibana/examples/user_profile_examples/public/tooltip_demo.tsx
Sid bffd4e14e7
[Security team] Update components for EUI visual refresh (#201795)
Closes https://github.com/elastic/kibana/issues/200005

## Summary

Integrate changes from the Borealis theme to components owned by
@elastic/kibana-security team.


### Notes

There are no visual changes in this PR. However:
- Switch from using `success` to `accentSecondary` where needed
- Switched from 'colors.disabled` to `colors.textDisabled`


### Screenshots

There isn't much to add but adding a few before/after screenshots of the
changes made



| Usage | Before | After |
|--------|--------|--------|
| API Key token field | <img width="446" alt="image"
src="https://github.com/user-attachments/assets/0167671c-b9e8-4493-88d9-514c524ccd06">
| <img width="469" alt="image"
src="https://github.com/user-attachments/assets/bde7f308-1ba4-4a92-bb27-e5875357ba49">
|
| User profile page | <img width="271" alt="image"
src="https://github.com/user-attachments/assets/668a66df-949a-4ce6-a390-d5ea2dd3489c">
| <img width="271" alt="image"
src="https://github.com/user-attachments/assets/a3965279-6f64-407c-923c-f7a07f474a14">
|
| Copy SO to space counter | <img width="991" alt="image"
src="https://github.com/user-attachments/assets/87a2cf3c-6b1f-4cf0-b818-03ed59133598">
| <img width="1161" alt="image"
src="https://github.com/user-attachments/assets/549648f1-297b-434d-b61b-d2761bc5d641">
|
| Space listing | <img width="604" alt="image"
src="https://github.com/user-attachments/assets/6db8f9df-4059-4a06-b49f-e48dd910277a"
/> |
![image](https://github.com/user-attachments/assets/5798590a-f65a-4fbe-b6b8-feb10dd62562)
|





### How to test

1. Start ES and KIB as:

```
yarn es snapshot --license trial
KBN_OPTIMIZER_THEMES=experimental yarn start --no-base-path
```

2. Navigate to `Stack Management > Advance Setting` and change the theme
to Borealis.
3. Verify the different screens as seen in the screenshots to see if
they render correctly with no visual regression


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-13 00:22:18 +11:00

65 lines
2.3 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import React, { FunctionComponent } from 'react';
import { UserAvatarTip, UserToolTip } from '@kbn/user-profile-components';
import type { UserProfile, UserProfileAvatarData } from '@kbn/user-profile-components';
import { EuiCommentList, EuiComment, useEuiTheme } from '@elastic/eui';
import { PanelWithCodeBlock } from './panel_with_code_block';
export const ToolTipDemo: FunctionComponent = () => {
const { euiTheme } = useEuiTheme();
const userProfile: UserProfile<{ avatar: UserProfileAvatarData }> = {
uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0',
enabled: true,
user: {
username: 'wet_dingo',
email: 'wet_dingo@elastic.co',
full_name: 'Wet Dingo',
},
data: {
avatar: {
color: euiTheme.colors.vis.euiColorVis1,
initials: 'WD',
imageUrl: 'https://source.unsplash.com/64x64/?dingo',
},
},
};
return (
<PanelWithCodeBlock title="Tooltip" code={code}>
<EuiCommentList>
<EuiComment
timelineAvatar={
<UserAvatarTip user={userProfile.user} avatar={userProfile.data.avatar} />
}
username={
<UserToolTip
position="top"
delay="regular"
user={userProfile.user}
avatar={userProfile.data.avatar}
>
<strong>{userProfile.user.full_name}</strong>
</UserToolTip>
}
event="pushed incident X0Z235 on Jan 3, 2020"
/>
</EuiCommentList>
</PanelWithCodeBlock>
);
};
const code = `import { UserToolTip, UserAvatarTip } from '@kbn/user-profile-components';
<UserToolTip user={userProfile.user} avatar={userProfile.data.avatar}>
<!-- An inline element to trigger the tooltip -->
</UserToolTip>
<UserAvatarTip user={userProfile.user} avatar={userProfile.data.avatar} />`;