Skip to content

Commit

Permalink
🐛 Fix setting menu functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
imptrx committed Jun 18, 2019
1 parent 7714832 commit 6d12677
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions components/brave_new_tab_ui/components/newTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class NewTabPage extends React.Component<Props, {}> {
}

return (
<DynamicBackground background={newTabData.backgroundImage.source}>
<Gradient />
<DynamicBackground showBackgroundImage={newTabData.showBackgroundImage} background={newTabData.backgroundImage.source}>
{newTabData.showBackgroundImage && <Gradient />}
<Page>
<Header>
<Stats stats={newTabData.stats} />
Expand Down Expand Up @@ -118,7 +118,7 @@ class NewTabPage extends React.Component<Props, {}> {
</Main>
</Header>
{
newTabData.showSettingsMenu &&
newTabData.showSettings &&
<Settings
onClickOutside={this.closeSettings}
toggleShowBackgroundImage={this.toggleShowBackgroundImage}
Expand All @@ -129,7 +129,7 @@ class NewTabPage extends React.Component<Props, {}> {
<FooterInfo
backgroundImageInfo={newTabData.backgroundImage}
onClickSettings={this.showSettings}
isSettingsMenuOpen={newTabData.showSettingsMenu}
isSettingsMenuOpen={newTabData.showSettings}
showPhotoInfo={newTabData.showBackgroundImage}
/>
</Footer>
Expand Down
24 changes: 12 additions & 12 deletions components/brave_new_tab_ui/reducers/new_tab_reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export const newTabReducer: Reducer<NewTab.State | undefined> = (state: NewTab.S
const startingState = state
const payload = action.payload
switch (action.type) {
case types.NEW_TAB_SHOW_SETTINGS_MENU:
state = { ...state, showSettings: true }
break

case types.NEW_TAB_CLOSE_SETTINGS_MENU:
state = { ...state, showSettings: false }
break

case types.NEW_TAB_TOGGLE_SHOW_BACKGROUND_IMAGE:
state = { ...state, showBackgroundImage: !state.showBackgroundImage }
break

case types.BOOKMARK_ADDED:
const topSite: NewTab.Site | undefined = state.topSites.find((site) => site.url === payload.url)
if (topSite) {
Expand Down Expand Up @@ -145,18 +157,6 @@ export const newTabReducer: Reducer<NewTab.State | undefined> = (state: NewTab.S
state = { ...state, useAlternativePrivateSearchEngine: payload.shouldUse }
break

case types.NEW_TAB_SHOW_SETTINGS_MENU:
state = { ...state, showSettings: true }
break

case types.NEW_TAB_CLOSE_SETTINGS_MENU:
state = { ...state, showSettings: false }
break

case types.NEW_TAB_TOGGLE_SHOW_BACKGROUND_IMAGE:
state = { ...state, showBackgroundImage: !state.showBackgroundImage }
break

default:
break
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
"@types/react-redux": "6.0.4",
"@types/redux-logger": "^3.0.7",
"awesome-typescript-loader": "^5.2.1",
"brave-ui": "github:brave/brave-ui#624be474ee7d3e4dc3409712ac9ec56e33ef9b04",
"brave-ui": "github:brave/brave-ui#584973511366801f9099d28a6d35604214afa146",
"css-loader": "^2.1.1",
"csstype": "^2.5.5",
"deep-freeze-node": "^1.1.3",
Expand Down

0 comments on commit 6d12677

Please sign in to comment.