Skip to content

Commit

Permalink
fix(TDOPS-4964/components): SidePanel colors (#4847)
Browse files Browse the repository at this point in the history
* fix(TDOPS-4964/components): SidePanel colors

* fix: add focus and active styles

* fix: linter errors

* fix: undo fork sass changes

* fix: remove package update

* fix: components build

* fix: linter errors

* fix: test and color tokens in use

* fix: test and color tokens in use

* fix: SidePanel test in containers
  • Loading branch information
inna-i authored Aug 22, 2023
1 parent 619d227 commit a5348a4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .changeset/real-needles-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@talend/react-components': patch
'@talend/bootstrap-theme': patch
---

TDOPS-4964 - Fix SidePanel colors
2 changes: 1 addition & 1 deletion packages/components/src/ActionList/ActionList.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function ActionList(props) {
'tc-action-list',
className,
{
'nav-inverse': props.reverse,
'nav-inverse': !props.reverse,
},
)}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ActionList/ActionList.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $tc-action-list-item-border-size: 0.2rem !default;
text-overflow: inherit;
text-transform: none;

> span {
>span {
margin-left: $padding-normal;
vertical-align: middle;
transition: 0.1s opacity ease-out;
Expand Down
8 changes: 3 additions & 5 deletions packages/components/src/SidePanel/SidePanel.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ function SidePanel({
const actionList = ref.current.querySelector('.tc-action-list');
setWidth(actionList.offsetWidth);
}
}, [ref, docked]);
}, [ref, docked, minimised, large]);

useEffect(() => {
// animation is disabled at first to avoid the panel to be animated at first render
// when the width is initialized, then we enable animation
if (!animation && width) {
setAnimation(true);
}
}, [width]);
}, [animation, width]);

const onToggle = (...args) => {
if (onToggleDock) {
Expand All @@ -101,9 +101,7 @@ function SidePanel({
[theme.reverse]: reverse,
[theme.animate]: animation,
});
const listCSS = classNames(theme['tc-side-panel-list'], 'tc-side-panel-list', {
'nav-inverse': !reverse,
});
const listCSS = classNames(theme['tc-side-panel-list'], 'tc-side-panel-list');

const expandLabel = t('SIDEPANEL_EXPAND', { defaultValue: 'Expand menu' });
const collapseTitle = t('SIDEPANEL_COLLAPSE', { defaultValue: 'Collapse menu' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`SidePanel should render 1`] = `
data-simplebar="true"
>
<ul
class="nav nav-pills nav-stacked theme-tc-action-list tc-action-list theme-tc-side-panel-list tc-side-panel-list nav-inverse nav-inverse"
class="nav nav-pills nav-stacked theme-tc-action-list tc-action-list theme-tc-side-panel-list tc-side-panel-list"
>
<li
class="theme-tc-action-list-item tc-action-list-item"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`SidePanel should render 1`] = `
data-simplebar="true"
>
<ul
class="nav nav-pills nav-stacked theme-tc-action-list tc-action-list theme-tc-side-panel-list tc-side-panel-list nav-inverse nav-inverse"
class="nav nav-pills nav-stacked theme-tc-action-list tc-action-list theme-tc-side-panel-list tc-side-panel-list"
/>
</div>
</nav>
Expand Down
29 changes: 19 additions & 10 deletions packages/theme/src/theme/_navs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ $tc-tabbar-active-border-size: 0.2rem !default;
margin: 0;
}

.btn-link {
color: tokens.$coral-color-accent-text-weak;
}

&:focus,
&:hover,
&:active {
.btn-link {
// TODO: replace with token
background-color: rgba(255, 255, 255, 0.12);
}
}

&.active,
&.open {
.btn-link {
color: tokens.$coral-color-accent-text-weak;
background-color: tokens.$coral-color-accent-background-strong;
background-color: tokens.$coral-color-neutral-background;
color: tokens.$coral-color-accent-text;
}
}

Expand Down Expand Up @@ -82,19 +94,16 @@ $tc-tabbar-active-border-size: 0.2rem !default;
.btn.btn-link {
width: 100%;
text-align: left;

&:focus,
&:hover,
&:active {
background-color: tokens.$coral-color-accent-background-strong;
color: tokens.$coral-color-accent-text-weak;
}
}
}
}

&-pills.nav-inverse {
> li {
.btn-link {
color: tokens.$coral-color-accent-text;
}

&:focus,
&:hover {
background-color: tokens.$coral-color-accent-background-hover;
Expand All @@ -108,7 +117,7 @@ $tc-tabbar-active-border-size: 0.2rem !default;
&:active,
&.active,
&.open {
background-color: tokens.$coral-color-accent-background-strong;
background-color: tokens.$coral-color-accent-background-weak;
}
}
}
Expand Down

0 comments on commit a5348a4

Please sign in to comment.