Skip to content

Commit

Permalink
WIP(ui-top-nav-bar): add inversColor to docs example
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrTopi authored and joyenjoyer committed Nov 2, 2023
1 parent ba90489 commit 06e3428
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/ui-top-nav-bar/src/TopNavBar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ example: true
---
<div>
<View as="div" margin="medium 0">
<TopNavBar>
<TopNavBar inverseColor>
{() => (
<TopNavBar.Layout
navLabel="Example navigation bar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ class TopNavBarBreadcrumb extends Component<

ref: HTMLDivElement | null = null

componentDidMount() {
this.props.makeStyles?.({ inverseColor: this.context.inverseColor })
}

componentDidUpdate() {
this.props.makeStyles?.({ inverseColor: this.context.inverseColor })
}

renderMenu() {
const { onClick } = this.props
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type TopNavBarBreadcrumbStyle = ComponentStyle<
>

type TopNavBarBreadcrumbStyleProps = {
layout: TopNavBarContextType['layout']
inverseColor: TopNavBarContextType['inverseColor']
}

export type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const generateStyle = (
_props: TopNavBarBreadcrumbProps,
_state: TopNavBarBreadcrumbStyleProps
): TopNavBarBreadcrumbStyle => {
// const isDesktop = state.layout === 'desktop'
//const { inverseColor } = state

return {
topNavBarBreadcrumb: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { topNavBarItemTooltipPropType } from '../TopNavBarItem/props'
import { TopNavBarLayout } from './index'
import type { DesktopLayoutOwnProps } from './DesktopLayout/props'
import type { SmallViewportLayoutOwnProps } from './SmallViewportLayout/props'
import { Breadcrumb } from '@instructure/ui-breadcrumb'
import { TopNavBarBreadcrumb } from '../TopNavBarBreadcrumb'

type LayoutChild = React.ComponentElement<TopNavBarLayoutProps, TopNavBarLayout>

Expand Down Expand Up @@ -139,7 +139,7 @@ const commonPropTypes: PropValidators<CommonPropKeys> = {
renderActionItems: ChildrenPropTypes.oneOf([TopNavBarActionItems]),
renderUser: ChildrenPropTypes.oneOf([TopNavBarUser]),
//TODO BreadCrumb wrapper
renderBreadcrumb: ChildrenPropTypes.oneOf([Breadcrumb]),
renderBreadcrumb: ChildrenPropTypes.oneOf([TopNavBarBreadcrumb]),
navLabel: PropTypes.string,
elementRef: PropTypes.func
}
Expand Down

0 comments on commit 06e3428

Please sign in to comment.