Skip to content

Commit 1e58f8e

Browse files
authored
Merge pull request #608 from reportportal/hotfix/external-links-arrows
Hotfix. Add external links arrows
2 parents f003faa + ebf51c8 commit 1e58f8e

File tree

6 files changed

+47
-12
lines changed

6 files changed

+47
-12
lines changed

src/components/Layout/Navigation/NavMenu/CommunityMenu/CommunityMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ export const CommunityMenu: FC<MenuProps> = ({ isDesktop = true, isOpen, menuCon
3434

3535
const communityList = (
3636
<SectionList
37-
className={classNames('community-list', { 'section-list-secondary': isDesktop })}
37+
className="community-list"
3838
title="Our social medias"
3939
items={communities}
40+
mode={isDesktop ? 'secondary' : 'primary'}
4041
/>
4142
);
4243

src/components/Layout/Navigation/NavMenu/OfferingsMenu/OfferingsMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { FC } from 'react';
2-
import classNames from 'classnames';
32
import { Link } from '@app/components/Link';
43
import { createBemBlockBuilder } from '@app/utils';
54
import { useMenuList } from '@app/hooks/useMenuList';
@@ -26,9 +25,10 @@ export const OfferingsMenu: FC<MenuProps> = ({ isDesktop = true, isOpen, menuCon
2625

2726
const pricingForSolutionsList = (
2827
<SectionList
29-
className={classNames('pricing-solutions-list', { 'section-list-secondary': isDesktop })}
28+
className="pricing-solutions-list"
3029
title="Pricing for Solutions"
3130
items={pricing}
31+
mode={isDesktop ? 'secondary' : 'primary'}
3232
/>
3333
);
3434

src/components/Layout/Navigation/NavMenu/ProductMenu/ProductMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ export const ProductMenu: FC<MenuProps> = ({ isDesktop = true, isOpen, menuConta
3838

3939
const integrationsList = (
4040
<SectionList
41-
className="section-list-secondary integrations-list"
41+
className="integrations-list"
4242
title="Integrations"
4343
items={integrations}
44+
mode="secondary"
4445
/>
4546
);
4647

src/components/Layout/Navigation/NavMenu/SectionList/SectionItem/SectionItem.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import React, { CSSProperties, FC, ReactElement } from 'react';
22
import { createPortal } from 'react-dom';
33
import classNames from 'classnames';
44
import { Link } from '@app/components/Link';
5-
import { ContentfulAsset, createBemBlockBuilder, isContentfulRecord, LinkDto } from '@app/utils';
5+
import {
6+
ContentfulAsset,
7+
createBemBlockBuilder,
8+
isAbsoluteURL,
9+
isContentfulRecord,
10+
LinkDto,
11+
} from '@app/utils';
12+
import ArrowIcon from '@app/svg/arrow.inline.svg';
613

714
interface SectionItemBaseProps {
815
title: string;
@@ -14,16 +21,18 @@ interface SectionItemBaseProps {
1421
iconClass?: string;
1522
className?: string;
1623
isDataFromContentful?: boolean;
24+
mode?: 'primary' | 'secondary';
1725
}
1826

1927
export type SectionItemProps =
2028
| (SectionItemBaseProps & { iconClass: string; icon?: never })
2129
| (SectionItemBaseProps & { icon: ContentfulAsset | ReactElement | string; iconClass?: never });
2230

2331
export const SectionItem: FC<SectionItemProps> = props => {
24-
const { title, link, icon, hoverIcon, iconClass, text, className = '' } = props;
32+
const { title, link, icon, hoverIcon, iconClass, text, className = '', mode = 'primary' } = props;
2533

2634
const getBlocksWith = createBemBlockBuilder(['section-item', className]);
35+
const shouldDisplayArrow = mode === 'secondary' && isAbsoluteURL(link.url);
2736

2837
const renderIcon = () => {
2938
const isDataFromContentful = isContentfulRecord(props);
@@ -59,7 +68,10 @@ export const SectionItem: FC<SectionItemProps> = props => {
5968
>
6069
{renderIcon()}
6170
<div>
62-
<p className={getBlocksWith('-title')}>{title}</p>
71+
<p className={getBlocksWith('-title')}>
72+
{title}
73+
{shouldDisplayArrow && <ArrowIcon className={getBlocksWith('-arrow')} />}
74+
</p>
6375
{text && <p className={getBlocksWith('-text')}>{text}</p>}
6476
</div>
6577
</Link>

src/components/Layout/Navigation/NavMenu/SectionList/SectionList.scss

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,16 @@
6767
}
6868
}
6969

70+
&:has(.section-item-arrow) {
71+
padding-right: 25px;
72+
}
73+
7074
&--no-text {
7175
padding-top: 16px;
7276
padding-bottom: 16px;
7377
line-height: 20px;
7478

75-
svg,
79+
& > svg,
7680
.section-item-icon {
7781
top: 8px;
7882
}
@@ -95,19 +99,28 @@
9599
color: var(--text-primary);
96100
}
97101

98-
& svg,
102+
& > svg,
99103
&-icon {
100104
position: absolute;
101105
top: 8px;
102106
left: 8px;
103107
width: 36px;
104108
height: 36px;
105109
}
110+
111+
&-arrow {
112+
position: absolute;
113+
top: 0;
114+
right: 12px;
115+
bottom: 0;
116+
margin: auto;
117+
color: var(--text-service);
118+
}
106119
}
107120

108121
.section-list-secondary {
109122
&__col {
110-
width: 200px;
123+
width: 210px;
111124
}
112125

113126
.section-item {

src/components/Layout/Navigation/NavMenu/SectionList/SectionList.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { FC } from 'react';
22
import chunk from 'lodash/chunk';
3+
import compact from 'lodash/compact';
34
import { createBemBlockBuilder } from '@app/utils';
45

56
import { SectionItem, SectionItemProps } from './SectionItem';
@@ -12,6 +13,7 @@ interface SectionListProps {
1213
className?: string;
1314
showTitle?: boolean;
1415
itemsPerRow?: number;
16+
mode?: 'primary' | 'secondary';
1517
}
1618

1719
export const SectionList: FC<SectionListProps> = ({
@@ -20,12 +22,18 @@ export const SectionList: FC<SectionListProps> = ({
2022
items,
2123
itemsPerRow = items.length,
2224
className = '',
25+
mode = 'primary',
2326
}) => {
24-
const getBlocksWith = createBemBlockBuilder(['section-list', className]);
27+
const bemClasses = compact([
28+
'section-list',
29+
mode === 'secondary' ? 'section-list-secondary' : undefined,
30+
className,
31+
]);
32+
const getBlocksWith = createBemBlockBuilder(bemClasses);
2533
const columns = chunk(items, itemsPerRow).map((column, columnIndex) => (
2634
<div key={columnIndex} className={getBlocksWith('__col')}>
2735
{column.map(data => (
28-
<SectionItem key={data.title} className={getBlocksWith('__item')} {...data} />
36+
<SectionItem key={data.title} className={getBlocksWith('__item')} {...data} mode={mode} />
2937
))}
3038
</div>
3139
));

0 commit comments

Comments
 (0)