Skip to content

Commit a416ee4

Browse files
committed
layout improvements
1 parent d1a1bd6 commit a416ee4

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

src/components/organisms/Events/molecules/EventRow/EventRow.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { FC } from 'react'
2-
import { theme as antdtheme, Flex } from 'antd'
2+
import { theme as antdtheme, Flex, Typography } from 'antd'
33
import { EarthIcon, getUppercase, hslFromString, Spacer } from '@prorobotech/openapi-k8s-toolkit'
44
import { useSelector } from 'react-redux'
55
import { RootState } from 'store/store'
@@ -16,11 +16,14 @@ export const EventRow: FC<TEventRowProps> = ({ e }) => {
1616
const theme = useSelector((state: RootState) => state.openapiTheme.theme)
1717

1818
const abbr = e.regarding?.kind ? getUppercase(e.regarding.kind) : undefined
19-
const bgColor = e.regarding?.kind && abbr ? hslFromString(abbr, theme) : 'initial'
20-
const bgColorNamespace = hslFromString('NS', theme)
19+
const bgColor = e.regarding?.kind && abbr ? hslFromString(e.regarding?.kind, theme) : 'initial'
20+
const bgColorNamespace = hslFromString('Namespace', theme)
2121

2222
return (
23-
<Styled.Card $colorText={token.colorText}>
23+
<Styled.Card
24+
$bigBorder={e.type === 'Warning'}
25+
$mainColor={e.type === 'Warning' ? token.colorWarningActive : token.colorText}
26+
>
2427
<Flex justify="space-between" align="center">
2528
<Flex align="center" gap={16}>
2629
<Flex align="center" gap={8}>
@@ -44,10 +47,21 @@ export const EventRow: FC<TEventRowProps> = ({ e }) => {
4447
)}
4548
</Flex>
4649
<Spacer $space={16} $samespace />
47-
<Flex gap={8} wrap>
50+
<Flex gap={8} align="center" wrap>
51+
<div>
52+
{e.deprecatedSource?.component && (
53+
<Flex gap={8} align="center" wrap>
54+
<Flex gap={6} align="center" wrap>
55+
<Typography.Text type="secondary">Generated by</Typography.Text>
56+
<Styled.Title>{e.deprecatedSource?.component}</Styled.Title>
57+
</Flex>
58+
<div>
59+
<Typography.Text type="secondary"></Typography.Text>
60+
</div>
61+
</Flex>
62+
)}
63+
</div>
4864
<Styled.Title>{e.reason || e.action || 'Event'}</Styled.Title>
49-
<Styled.Title></Styled.Title>
50-
<Styled.Title>{e.type || 'Normal'}</Styled.Title>
5165
</Flex>
5266
<Spacer $space={16} $samespace />
5367
{eventText(e) && <div>{eventText(e)}</div>}

src/components/organisms/Events/molecules/EventRow/styled.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import styled from 'styled-components'
22

33
type TCardProps = {
4-
$colorText: string
4+
$mainColor: string
5+
$bigBorder?: boolean
56
}
67

78
const Card = styled.div<TCardProps>`
89
border-radius: 6px;
910
padding: 16px 8px;
10-
border: 1px solid ${({ $colorText }) => $colorText};
11+
border: ${({ $bigBorder }) => ($bigBorder ? 2 : 1)}px solid ${({ $mainColor }) => $mainColor};
1112
gap: 12px;
1213
margin-bottom: 16px;
1314
position: relative;
@@ -16,8 +17,8 @@ const Card = styled.div<TCardProps>`
1617
position: absolute;
1718
content: '';
1819
width: 36px;
19-
height: 1px;
20-
background: ${({ $colorText }) => $colorText};
20+
height: ${({ $bigBorder }) => ($bigBorder ? 2 : 1)}px;
21+
background: ${({ $mainColor }) => $mainColor};
2122
left: -37px;
2223
top: 50%; /* halfway down parent */
2324
transform: translateY(-50%); /* center vertically */
@@ -26,11 +27,11 @@ const Card = styled.div<TCardProps>`
2627
&:after {
2728
position: absolute;
2829
content: '';
29-
width: 6px;
30-
height: 6px;
30+
width: ${({ $bigBorder }) => ($bigBorder ? 7 : 6)}px;
31+
height: ${({ $bigBorder }) => ($bigBorder ? 7 : 6)}px;
3132
border-radius: 50%;
32-
background: ${({ $colorText }) => $colorText};
33-
left: -39px;
33+
background: ${({ $mainColor }) => $mainColor};
34+
left: ${({ $bigBorder }) => ($bigBorder ? -41 : -39)}px;
3435
top: 50%;
3536
transform: translateY(-50%);
3637
}

0 commit comments

Comments
 (0)