@@ -2,11 +2,10 @@ import React, { Fragment } from 'react'
22import PropTypes from 'prop-types'
33import classnames from 'classnames'
44
5- import QuickActions from './QuickActions.es6.js'
65import SidebarBackButton from './SidebarBackButton.es6.js'
7- import SidebarHeaderActionButton from './SidebarHeaderActionButton.es6.js'
86import Button from '../../../form/button/Button.es6.js'
97import { B12Logo } from '../../../Icons.es6.js'
8+ import ActionDropdown from './ActionDropdown.es6.js'
109
1110class SidebarHeader extends React . Component {
1211 state = {
@@ -74,42 +73,62 @@ class SidebarHeader extends React.Component {
7473 quickDialog,
7574 showLogo,
7675 steps,
77- title
76+ title,
77+ showManagerSwitcher,
7878 } = this . props
7979 const { actionsAvailable, actionsVisible } = this . state
8080
8181 return (
8282 < Fragment >
83- < div className = "ds-sidebar__header" >
84- < div className = "ds-sidebar__header-back" >
85- { showLogo && < B12Logo color = "#6548c7" width = { 46 } height = { 20 } viewBox = "0 0 200 80" className = "ds-sidebar__header-logo" /> }
86-
87- { ! showLogo && backButton && onBack && (
88- < SidebarBackButton
89- text = { backButtonText }
90- hideText = { isScrollingDown }
91- onClick = { onBack }
92- />
93- ) }
94-
95- { ! showLogo && ! backButton && leftAction }
96-
97- { homeButton && (
98- < React . Fragment >
99- < div className = "ds-sidebar__header-divider" />
100- { ! isScrollingDown && (
101- < Button
102- small
103- className = "ds-sidebar__header-home"
104- icon = { < B12Logo width = { 30 } height = { 20 } color = "#84839c" viewBox = "0 0 200 80" /> }
105- onClick = { onHomeClick }
106- />
107- ) }
108- </ React . Fragment >
109- ) }
110-
111- { isScrollingDown && < div > { title } </ div > }
112- </ div >
83+ < div className = { classnames ( 'ds-sidebar__header' , { 'ds-sidebar__header--website-manager' : showManagerSwitcher } ) } >
84+ { ! showManagerSwitcher && (
85+ < div className = "ds-sidebar__header-back" >
86+ { showLogo && < B12Logo color = "#6548c7" width = { 46 } height = { 20 } viewBox = "0 0 200 80" className = "ds-sidebar__header-logo" /> }
87+
88+ { ! showLogo && backButton && onBack && (
89+ < SidebarBackButton
90+ text = { backButtonText }
91+ hideText = { isScrollingDown }
92+ onClick = { onBack }
93+ />
94+ ) }
95+
96+ { ! showLogo && ! backButton && leftAction }
97+
98+ { homeButton && (
99+ < React . Fragment >
100+ < div className = "ds-sidebar__header-divider" />
101+ { ! isScrollingDown && (
102+ < Button
103+ small
104+ className = "ds-sidebar__header-home"
105+ icon = { < B12Logo width = { 30 } height = { 20 } color = "#84839c" viewBox = "0 0 200 80" /> }
106+ onClick = { onHomeClick }
107+ />
108+ ) }
109+ </ React . Fragment >
110+ ) }
111+
112+ { isScrollingDown && < div > { title } </ div > }
113+ </ div >
114+ ) }
115+
116+ { /* Show actions dropdown under B12 logo if AI website manager is available */ }
117+ { showManagerSwitcher && (
118+ < ActionDropdown
119+ ref = { this . actionsRef }
120+ icon = { < B12Logo color = "#6548c7" width = { 46 } height = { 20 } viewBox = "0 0 200 80" className = "ds-sidebar__header-logo" /> }
121+ onClick = { this . onAction }
122+ actionsAvailable = { actionsAvailable }
123+ actionsVisible = { actionsVisible }
124+ setActionsVisibility = { ( state ) => this . setState ( { actionsVisible : state } ) }
125+ quickDialog = { quickDialog }
126+ quickActions = { quickActions }
127+ dropdownMenuLabel = { dropdownMenuLabel }
128+ onQuickActionSelected = { onQuickActionSelected }
129+ isLogoDropDown
130+ /> )
131+ }
113132
114133 { ! children && steps && (
115134 < div className = "ds-sidebar__header-title" >
@@ -120,37 +139,21 @@ class SidebarHeader extends React.Component {
120139
121140 { children }
122141
123- < div
124- className = { classnames ( {
125- 'ds-dropdown' : actionsAvailable && actionIcon ,
126- 'ds-dropdown--right' : actionsAvailable && actionIcon ,
127- 'ds-dropdown--menu-visible' : actionsAvailable && actionsVisible ,
128- 'ds-sidebar__header-action' : ! actionsAvailable
129- } ) }
130- ref = { this . actionsRef }
131- >
132- { actionIcon && (
133- < SidebarHeaderActionButton
134- dropdown = { actionsAvailable }
135- icon = { actionIcon }
136- onClick = { this . onAction }
137- />
138- ) }
139-
140- { quickDialog }
141-
142- { actionsVisible && (
143- < QuickActions
144- actions = { quickActions }
145- label = { dropdownMenuLabel }
146- onSelect = { ( idx ) => {
147- this . setState ( { actionsVisible : false } , ( ) => {
148- onQuickActionSelected && onQuickActionSelected ( idx )
149- } )
150- } }
151- />
152- ) }
153- </ div >
142+ { ! showManagerSwitcher && (
143+ < ActionDropdown
144+ ref = { this . actionsRef }
145+ icon = { actionIcon }
146+ onClick = { this . onAction }
147+ actionsAvailable = { actionsAvailable }
148+ actionsVisible = { actionsVisible }
149+ setActionsVisibility = { ( state ) => this . setState ( { actionsVisible : state } ) }
150+ quickDialog = { quickDialog }
151+ quickActions = { quickActions }
152+ dropdownMenuLabel = { dropdownMenuLabel }
153+ onQuickActionSelected = { onQuickActionSelected }
154+ /> )
155+ }
156+
154157 < div
155158 className = "ds-sidebar__header-progress"
156159 style = { { width : `${ progress } %` } }
@@ -177,7 +180,8 @@ SidebarHeader.defaultProps = {
177180 quickActions : [ ] ,
178181 showLogo : false ,
179182 quickDialog : null ,
180- tabbedNavigation : null
183+ tabbedNavigation : null ,
184+ showManagerSwitcher : false ,
181185}
182186
183187SidebarHeader . propTypes = {
@@ -202,7 +206,8 @@ SidebarHeader.propTypes = {
202206 onQuickActionSelected : PropTypes . func ,
203207 showLogo : PropTypes . bool ,
204208 quickDialog : PropTypes . element ,
205- tabbedNavigation : PropTypes . element
209+ tabbedNavigation : PropTypes . element ,
210+ showManagerSwitcher : PropTypes . bool ,
206211}
207212
208213export default SidebarHeader
0 commit comments