imageForBar.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import styled from '@emotion/styled';
  2. import FunctionName from 'sentry/components/events/interfaces/frame/functionName';
  3. import {t} from 'sentry/locale';
  4. import space from 'sentry/styles/space';
  5. import {Frame} from 'sentry/types';
  6. type Props = {
  7. frame: Frame;
  8. onShowAllImages: (filter: string) => void;
  9. };
  10. const ImageForBar = ({frame, onShowAllImages}: Props) => {
  11. const handleShowAllImages = () => {
  12. onShowAllImages('');
  13. };
  14. return (
  15. <Wrapper>
  16. <MatchedFunctionWrapper>
  17. <MatchedFunctionCaption>{t('Image for: ')}</MatchedFunctionCaption>
  18. <FunctionName frame={frame} />
  19. </MatchedFunctionWrapper>
  20. <ResetAddressFilterCaption onClick={handleShowAllImages}>
  21. {t('Show all images')}
  22. </ResetAddressFilterCaption>
  23. </Wrapper>
  24. );
  25. };
  26. const Wrapper = styled('div')`
  27. display: flex;
  28. align-items: baseline;
  29. justify-content: space-between;
  30. padding: ${space(0.5)} ${space(2)};
  31. background: ${p => p.theme.backgroundSecondary};
  32. border-bottom: 1px solid ${p => p.theme.border};
  33. font-weight: 700;
  34. code {
  35. color: ${p => p.theme.blue300};
  36. font-size: ${p => p.theme.fontSizeSmall};
  37. background: ${p => p.theme.backgroundSecondary};
  38. }
  39. a {
  40. color: ${p => p.theme.blue300};
  41. &:hover {
  42. text-decoration: underline;
  43. }
  44. }
  45. `;
  46. const MatchedFunctionWrapper = styled('div')`
  47. display: flex;
  48. align-items: baseline;
  49. `;
  50. const MatchedFunctionCaption = styled('span')`
  51. font-size: ${p => p.theme.fontSizeSmall};
  52. font-weight: 400;
  53. color: ${p => p.theme.gray300};
  54. flex-shrink: 0;
  55. `;
  56. const ResetAddressFilterCaption = styled('a')`
  57. display: flex;
  58. flex-shrink: 0;
  59. padding-left: ${space(0.5)};
  60. font-size: ${p => p.theme.fontSizeSmall};
  61. font-weight: 400;
  62. color: ${p => p.theme.gray300} !important;
  63. &:hover {
  64. color: ${p => p.theme.gray300} !important;
  65. }
  66. `;
  67. export default ImageForBar;