Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Commit bb6aab9

Browse files
authored
Merge pull request #353 from cjdev/CJPM-18122
Add subtitle slot on TopNav
2 parents 75a075b + 7716a5c commit bb6aab9

8 files changed

Lines changed: 31 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Upcoming
2+
3+
## Updates
4+
- TopNav: add subtitle prop for centered text in nav
5+
16
# 7.3.2
27

38
## Fix

packages/visual-stack-docs/src/containers/Components/Docs/topnav.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const TopNavCodeSnippet1 = ({router}) => (
6262
/* s1:start */
6363
<TopNav
6464
title="Header Title"
65+
subtitle="Subtitle"
6566
actionChildren={
6667
<Box direction="row" gap="xl" align="center" grow>
6768
<BackToCjLink title="Back to the Home Page" onClick={() => router.push('/components/topnav')}/>

packages/visual-stack-redux/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/visual-stack/src/components/TopNav/BackToCjLink.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export const BackToCjLink = ({ className, title, onClick, ...restProps }) => {
1717
onClick={onClick}
1818
className="topnav-action"
1919
>
20-
<Text id="topnav-back-icon" className="vs-topnav-action-text">
20+
<Text id="topnav-back-icon" className="vs-topnav-action vs-topnav-text">
2121
<ArrowLeftIcon />
2222
</Text>
23-
<Text id="topnav-back-title" className="vs-topnav-action-text">
23+
<Text id="topnav-back-title" className="vs-topnav-action vs-topnav-text">
2424
{title}
2525
</Text>
2626
</Box>

packages/visual-stack/src/components/TopNav/CjSupportLink.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ export const CjSupportLink = ({ className, title, link, ...restProps }) => {
2121
align="center"
2222
className="vs-topnav-action"
2323
>
24-
<Text id="topnav-help-icon" className="vs-topnav-action-text">
24+
<Text
25+
id="topnav-help-icon"
26+
className="vs-topnav-action vs-topnav-text"
27+
>
2528
<InformationOutlineIcon />
2629
</Text>
27-
<Text id="topnav-help-title" className="vs-topnav-action-text">
30+
<Text
31+
id="topnav-help-title"
32+
className="vs-topnav-action vs-topnav-text"
33+
>
2834
{title}
2935
</Text>
3036
</Box>

packages/visual-stack/src/components/TopNav/TopNav.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
background: #4d5051;
1010
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
1111
z-index: 20;
12+
flex-wrap: wrap;
1213
}
1314

1415
.vs-topnav-page-title {
@@ -82,13 +83,11 @@
8283
}
8384

8485
.vs-topnav-action {
85-
color: #bebfc0 !important;
8686
cursor: pointer;
8787
}
8888

89-
.vs-topnav-action-text {
89+
.vs-topnav-text {
9090
color: #bebfc0 !important;
91-
cursor: pointer;
9291
}
9392

9493
a.vs-cj-support-link-container:hover {

packages/visual-stack/src/components/TopNav/TopNav.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
66
export const TopNav = ({
77
className,
88
title,
9+
subtitle,
910
actionChildren,
1011
children,
1112
contentSize,
@@ -20,6 +21,7 @@ export const TopNav = ({
2021
</div>
2122
<h1 className="vs-topnav-title">{title}</h1>
2223
</div>
24+
{subtitle ? <div className={'vs-topnav-text'}>{subtitle}</div> : ''}
2325
<div className="vs-topnav-button-bar">{actionChildren}</div>
2426
</div>
2527
<div
@@ -39,5 +41,6 @@ TopNav.propTypes = {
3941
title: PropTypes.string,
4042
actionChildren: PropTypes.object,
4143
children: PropTypes.object,
44+
subtitle: PropTypes.string,
4245
contentSize: PropTypes.string,
4346
};

packages/visual-stack/src/components/TopNav/tests/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('BackToCjLink', () => {
6565
expect(wrapper.find(BackToCjLink).prop('title')).toBe('title');
6666
expect(wrapper.find(BackToCjLink).prop('onClick')()).toBe(2);
6767
expect(
68-
wrapper.find('.vs-topnav-action-text>#topnav-back-title').text()
68+
wrapper.find('.vs-topnav-action.vs-topnav-text>#topnav-back-title').text()
6969
).toEqual('title');
7070
});
7171
});
@@ -75,9 +75,9 @@ describe('CjSupportLink', () => {
7575
const wrapper = mount(<CjSupportLink title="title" link="link" />);
7676
expect(wrapper.find(CjSupportLink).prop('title')).toBe('title');
7777
expect(wrapper.find(CjSupportLink).prop('link')).toBe('link');
78-
expect(wrapper.find('.vs-topnav-action>#topnav-help-title').text()).toEqual(
79-
'title'
80-
);
78+
expect(
79+
wrapper.find('.vs-topnav-action.vs-topnav-text>#topnav-help-title').text()
80+
).toEqual('title');
8181
expect(wrapper.find('.vs-cj-support-link-container').props().href).toEqual(
8282
'link'
8383
);

0 commit comments

Comments
 (0)