For zero notifications the class "-hasNotifEmpty" gets added to the "sds-navTopbar__item" element
For one or more notifications the class "-hasNotif" gets added to the "sds-navTopbar__item" element
The class "-hasLabelShown" can be added with a slight delay to show the transition
<header class="sds-navTopbar">
<div class="sds-navTopbar__container">
<nav class="sds-navTopbar__inner navbar navbar-expand">
<a href="#back" class="sds-navTopbar__back">
<span class="sds-iconCircle" aria-hidden="true">
<span class="sds-icon sds-icon-chevronleft"></span>
</span>
<span class="sds-textHelper sds-navTopbar__backText">Retour</span>
</a>
<a class="sds-navTopbar__logo navbar-brand" href="#">
<img src="../../media/logos/logo-bcee.svg" class="img-fluid" alt="">
</a>
<div class="sds-navTopbar__centeredContent sds-navTopbar__dropdownWrapper dropdown sds-textHelper">
<button type="button" class="sds-navTopbar__dropdownToggle -transparent dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span>Déclaration fiscale 2021</span>
<span class="sds-iconCircle" aria-hidden="true">
<span class="sds-icon sds-icon-chevrondown"></span>
</span>
</button>
<div aria-labelledby="" class="sds-actionMenu dropdown-menu dropdown-menu-center">
<a href="" class="sds-actionMenu__item dropdown-item">
Item 1
</a>
<a href="" class="sds-actionMenu__item dropdown-item">
Item 2
</a>
<a href="" class="sds-actionMenu__item dropdown-item">
Item 3
</a>
</div>
</div>
<div class="sds-navTopbar__collapse navbar-collapse" id="sds-navTopbar__collapse">
<ul class="sds-navTopbar__content navbar-nav">
<li class="sds-navTopbar__item sds-navTopbar__dropdownWrapper dropdown">
<button type="button" class="sds-navTopbar__dropdownToggle -avatar dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<div class="sds-avatar centeredBgi sds-navTopbar__userDropdownAvatar">
<img class="img-fluid" src="../../media/snet/avatars/avatarUser.png" alt="">
</div>
<span class="sds-navTopbar__userDropdownLabel sds-textHelper">Label with Name</span>
<span class="sds-iconCircle" aria-hidden="true">
<span class="sds-icon sds-icon-chevrondown"></span>
</span>
</button>
</li>
</ul>
</div>
</nav>
</div>
</header>
<header class="{{ namespace }}navTopbar{% for mod in modifiers %} {{ mod }}{% endfor %}{% for mod in classes %} {{ mod }}{% endfor %}">
<div class="{{ namespace }}navTopbar__container">
<nav class="{{namespace}}navTopbar__inner navbar navbar-expand">
<a href="#back" class="{{namespace}}navTopbar__back">
{% render '@icon-circle-regular',{
icon: "icon-chevronleft"
},true %}
<span class="{{ namespace }}textHelper {{ namespace }}navTopbar__backText">{{ backText }}</span>
</a>
<a class="{{ namespace }}navTopbar__logo navbar-brand" href="#">
<img src="{{ (mediaPath + '/logos/logo-bcee.svg') | path }}" class="img-fluid" alt="">
</a>
<div class="{{ namespace }}navTopbar__centeredContent {{ namespace }}navTopbar__dropdownWrapper dropdown {{ namespace }}textHelper">
{% if noDropdown %}
<span>{{ text }}</span>
{% else %}
<button type="button" class="{{ namespace }}navTopbar__dropdownToggle -transparent dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span>Déclaration fiscale 2021</span>
{% render "@icon-circle-regular",{icon: "icon-chevrondown"},true %}
</button>
{% render "@snet-action-menu",{classes: ["dropdown-menu-center"]},true %}
{% endif %}
</div>
<div class="{{ namespace }}navTopbar__collapse navbar-collapse" id="{{ namespace }}navTopbar__collapse">
<ul class="{{ namespace }}navTopbar__content navbar-nav">
<li class="{{ namespace }}navTopbar__item {{ namespace }}navTopbar__dropdownWrapper dropdown">
<button type="button" class="{{ namespace }}navTopbar__dropdownToggle -avatar dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
{% render "@avatar--image",{classes: [namespace + "navTopbar__userDropdownAvatar"]},true %}
<span class="{{ namespace }}navTopbar__userDropdownLabel {{ namespace }}textHelper">{{ nameUser }}</span>
{% render "@icon-circle-regular",{icon: "icon-chevrondown"}, true %}
</button>
</li>
</ul>
</div>
</nav>
</div>
</header>
/* variables specific to current element */
$nav-topbar-height: $nav-topbar-height-global;
$nav-topbar-icon-background: map-deep-get($token-color-brand-map,"secondary","100");
$nav-topbar-icon-background-hover: map-deep-get($token-color-brand-map,"secondary","120");
$nav-topbar-logo-mobile-width: $nav-topbar-logo-mobile-width-global;
$nav-topbar-logo-desktop-width: 220px;
$snet-frame-menu-open-width: $snet-frame-menu-open-width-global;
$bfm-nav-topbar-icon-background: map-deep-get($token-color-brand-map,"secondary","160");
$bfm-nav-topbar-icon-background-hover: map-deep-get($token-color-grayscale-map,"1000");
.#{$namespace}navTopbar {
/* Save root element context for easy access if nesting is needed */
$self: &;
/* properties of current element + media queries */
@include gradient-directional(map-deep-get($token-color-brand-map, "secondary", "100"), map-deep-get($token-color-brand-map, "gradient", "secondary"), 0, 100%, 45deg, true);
color: map-deep-get($token-color-grayscale-map, "0");
height: $nav-topbar-height;
display: flex;
align-items: center;
/* Pseudo Elements */
&::before {
}
&::after {
}
/*
Include elements that are linked to the current element but have to reside at the root level of the stylesheet
(e.g: keyframes)
*/
@at-root {
}
/* children - write selector in full in comments in order to facilitate search */
&__container {
padding: 0;
@include make-container();
max-width: none;
@media screen and (min-width: map-get($tweakpoint-map, "tablet")) {
max-width: map-deep-get($container-max-widths, "xl");
}
}
// navTopbar__inner
&__inner {
padding: 0;
> {
H1,.h1,
H2,.h2,
H3,.h3,
H4,.h4,
H5,.h5,
H6,.h6 {
color: inherit;
font-size: map-deep-get($design-tokens, "sys-font-size-helper-medium") !important;
font-family: inherit !important;
font-weight: map-deep-get($token-font-weight-map, "semi-bold") !important;
}
}
}
&__alignToMainContent {
display: flex;
align-items: center;
@media screen and (min-width: map-get($tweakpoint-map, "tablet")) {
width: $snet-frame-menu-open-width;
margin-right: map-deep-get($token-spacer-unit-map, "16");
}
}
// navTopbar__back
&__back {
display: flex;
align-items: center;
margin-right: map-deep-get($token-spacer-unit-map, "8");
border-radius: map-deep-get($token-radius-map, "32");
font-weight: map-deep-get($token-font-weight-map, "semi-bold");
background-color: $nav-topbar-icon-background-hover;
height: $language-switcher-height-global;
@include media-breakpoint-up(lg) {
height: auto;
background-color: transparent;
padding-right: map-deep-get($token-spacer-unit-map, "16");
margin-right: map-deep-get($token-spacer-unit-map, "24");
}
&:hover,
&:focus {
@media (hover: hover) {
background-color: $nav-topbar-icon-background-hover;
}
}
}
&__centeredContent,
&__backText {
display: none;
@include media-breakpoint-up(lg) {
display: block;
}
}
// navTopbar__logo
&__logo {
width: $nav-topbar-logo-mobile-width-global;
height: $nav-topbar-logo-mobile-width-global;
overflow: hidden;
padding: 0;
margin-right: map-deep-get($token-spacer-unit-map, '16');
@include media-breakpoint-up(md){
width: $nav-topbar-logo-desktop-width;
height: auto;
}
IMG {
height: $nav-topbar-logo-mobile-width-global;
max-width: none;
@include media-breakpoint-up(md){
width: 100%;
height: auto;
max-width: 100%;
}
}
}
// navTopbar__collapse
&__collapse {
flex-grow: 0;
margin-left: auto;
}
// navTopbar__meta
&__meta {
// follows same logic as parent
display: none;
@include media-breakpoint-up(md){
font-weight: map-deep-get($token-font-weight-map, "semi-bold");
display: flex;
align-items: center;
}
}
&__centeredContent {
margin: auto;
font-weight: map-deep-get($token-font-weight-map, "semi-bold");
}
&__dropdownWrapper {
.dropdown-menu {
top: $nav-topbar-height;
}
}
// navTopbar__metaTime
&__metaTime {
color: map-deep-get($token-color-brand-map, 'secondary', '30');
display: none;
@media screen and (min-width: map-get($tweakpoint-map, "tablet")) {
display: block;
}
}
// navTopbar__content
&__content {
// follows same logic as parent
margin-left: auto;
@include spacer-component-inline("md");
}
&__item {
display: flex;
align-items: center;
position: relative;
z-index: z("low");
&.dropdown.show {
// follows same logic as base element
position: relative;
#{$self}__userMenu {
display: block;
}
}
&.-hasNotifEmpty {
#{$self}__icon {
@include gradient-directional(map-deep-get($token-color-brand-map, "primary", "100"), map-deep-get($token-color-brand-map, "gradient", "primary"), 0, 100%, 45deg, true);
}
}
&.-hasNotif {
position: relative;
#{$self}__icon {
position: relative;
z-index: z("low");
}
}
&.-hasLabelShown {
#{$self}__notificationLabel {
transform: scaleX(1) translateY(-50%);
}
#{$self}__notificationLabelText {
transition: opacity 0.1s linear;
transition-delay: 0.2s;
opacity: 1;
}
}
&:hover {
@media (hover: hover) {
#{$self}__itemIcon {
background-color: map-deep-get($token-color-brand-map,"secondary","120");
}
}
}
}
&__notificationLabel {
background-color: map-deep-get($token-color-grayscale-map, "0");
color: map-deep-get($token-color-grayscale-map, "1000");
position: absolute;
z-index: z("negative");
top: 50%;
transform: scaleX(0) translateY(-50%);
right: map-deep-get($token-spacer-unit-map, "16");
@include spacer-component-inset-horiz-greater("xs","sm");
padding-right: map-deep-get($token-spacer-unit-map, "32");
border-radius: map-deep-get($token-radius-map, "16");
transition: transform 0.15s ease-out;
transform-origin: right;
font-weight: map-deep-get($token-font-weight-map, "bold");
font-size: map-deep-get($design-tokens, "sys-font-size-helper-small");
}
&__notificationLabelText {
opacity: 0;
}
&__notificationLabelIcon {
display: inline-block;
transform: translateX(2px);
}
&__itemNotifAnim {
position: absolute;
z-index: z("low");
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%);
pointer-events: none;
}
&__itemLabel {
font-weight: #{map-deep-get($token-font-weight-map, "semi-bold")};
margin-left: map-deep-get($token-spacer-unit-map,"8");
display: none;
@media screen and (min-width: map-get($tweakpoint-map, "tablet")) {
display: block;
}
}
// navTopbar__meta
// navTopbar__content
&__meta,
&__content {
@include spacer-component-inline('md');
}
&__dropdownToggle {
position: relative;
background-color: $nav-topbar-icon-background;
border-radius: map-deep-get($token-radius-map, "32");
display: flex;
align-items: center;
padding-left: map-deep-get($token-spacer-unit-map, "16");
font-weight: map-deep-get($token-font-weight-map, "semi-bold");
.#{$namespace}iconCircle {
display: none;
transition: transform 0.15s linear;
@include media-breakpoint-up(md){
display: inline-flex;
}
}
* {
color: map-deep-get($token-color-grayscale-map, "0");
}
&[aria-expanded="true"] {
> [class*="icon"] {
transform: rotate(180deg);
}
}
&.-avatar {
padding-left: 0;
}
&.-transparent {
background-color: transparent;
}
&.-noInteraction {
&:hover {
background-color: transparent;
}
}
&:hover {
background-color: $nav-topbar-icon-background-hover;
}
}
&__userDropdownAvatar {
}
&__userDropdownLabel {
padding-left: map-deep-get($token-spacer-unit-map, "8");
@include truncate-text(160px);
@include media-breakpoint-between(xs,sm){
@include sr-only;
}
@media screen and (min-width: map-get($tweakpoint-map, "tablet")) {
font-weight: #{map-deep-get($token-font-weight-map, "semi-bold")};
}
}
&__userMenu {
display: none;
position: absolute;
top: #{$nav-topbar-height};
width: 430px;
right: -(map-deep-get($token-sizes-unit-map, "72"));
margin-right: $snet-frame-main-horiz-padding-mobile-global;
@include media-breakpoint-up(sm){
right: 0;
margin-right: 0;
}
}
/* modifiers */
// navTopbar -altStyle
/* random parent element */
/*
*
* Syntax : .randomParentElt & {}
*
*/
.cpb-theme &,
.bfm-theme & {
// follows same logic as base element
@include gradient-directional(map-deep-get($token-color-brand-map, "secondary", "160"), map-deep-get($token-color-brand-map, "secondary", "140"), 0, 100%, 45deg, true);
&__back {
background-color: $bfm-nav-topbar-icon-background;
&:hover,
&:focus {
@media (hover: hover) {
background-color: $bfm-nav-topbar-icon-background;
}
}
}
&__icon,
&__dropdownToggle {
background-color: $bfm-nav-topbar-icon-background;
&:hover {
background-color: $bfm-nav-topbar-icon-background-hover;
}
}
&__hoverBackground {
&:hover {
background-color: $bfm-nav-topbar-icon-background-hover;
}
}
}
.-fullWidth & {
#{$self}__container {
max-width: none;
}
}
/* Pseudo Classes */
&:hover {
@media (hover: hover) {
}
}
&:focus {
}
&:active {
}
&:focus,
&:active {
}
}